:root {
    --primary-color: #6BB3D9;
    --primary-dark: #3498DB;
    --primary-light: #AED6F1;
    --bg-color: #E8F4FC;
    --bg-gradient: linear-gradient(135deg, #E8F4FC 0%, #F0F8FF 100%);
    --surface-color: #FFFFFF;
    --text-color: #2C3E50;
    --text-muted: #7F8C8D;
    --text-light: #95A5A6;
    --border-color: #D6EAF8;
    --hover-bg: #F4F9FC;
    --shadow-sm: 0 2px 8px rgba(107, 179, 217, 0.1);
    --shadow-md: 0 4px 16px rgba(107, 179, 217, 0.15);
    --shadow-lg: 0 8px 24px rgba(107, 179, 217, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.8;
    font-size: 16px;
    padding: 2rem 1rem;
    min-height: 100vh;
}

a {
    text-decoration: none;
    transition: all var(--transition-fast);
    color: var(--text-color);
}

a:hover {
    color: var(--primary-color);
}

ul, li {
    list-style: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    gap: 2rem;
}

.post-tags-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    height: fit-content;
    animation: fadeUp 0.5s ease;
}

.tags-header {
    font-size: 1.1rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    padding-left: 12px;
}

.tags-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-radius: 2px;
}

.post-tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.post-tag-item {
    padding: 0.5rem 1rem;
    background-color: var(--hover-bg);
    border-radius: var(--radius-md);
    color: var(--primary-dark);
    font-size: 0.9rem;
    text-align: center;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.post-tag-item:hover {
    background-color: var(--primary-light);
    transform: translateX(4px);
}

.back-home {
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(107, 179, 217, 0.3);
}

.back-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 179, 217, 0.4);
}

.post-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.6s ease;
}

.post-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.post-title {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.4;
    font-weight: 700;
}

.post-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.post-body {
    font-size: 1.05rem;
    color: var(--text-color);
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body h2 {
    color: var(--primary-dark);
    margin: 2rem 0 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    position: relative;
    padding-left: 12px;
}

.post-body h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-radius: 2px;
}

.post-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    box-shadow: var(--shadow-md);
}

.post-body a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-light);
    transition: all var(--transition-fast);
}

.post-body a:hover {
    color: var(--primary-dark);
    border-bottom: 1px solid var(--primary-dark);
}

.post-attachments {
    position: sticky;
    top: 2rem;
    height: fit-content;
    animation: fadeUp 0.7s ease;
}

.attachment-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.attachment-header {
    font-size: 1.1rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-left: 12px;
}

.attachment-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-radius: 2px;
}

.attachment-header i {
    font-size: 1.2rem;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background-color: var(--hover-bg);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.attachment-item:hover {
    background-color: var(--primary-light);
    transform: translateX(2px);
}

.attachment-icon {
    font-size: 1.2rem;
    color: var(--primary-dark);
    width: 24px;
    text-align: center;
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.attachment-size {
    font-size: 0.8rem;
    color: var(--text-light);
}

.attachment-extract-code {
    font-size: 0.8rem;
    color: var(--primary-dark);
    margin-top: 0.2rem;
}

.attachment-download {
    color: var(--primary-dark);
    font-size: 1.1rem;
    transition: color var(--transition-fast);
}

.attachment-download:hover {
    color: var(--primary-color);
}

.attachment-disabled {
    color: var(--text-light);
    font-size: 1rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 380px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: modalIn 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-box h3 {
    margin-bottom: 1rem;
    color: var(--primary-dark);
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-box p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-box input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-bottom: 0.4rem;
    outline: none;
    transition: all var(--transition-fast);
    background: var(--hover-bg);
    color: var(--text-color);
}

.modal-box input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(107, 179, 217, 0.1);
}

.error-tip {
    color: #e74c3c;
    font-size: 0.85rem;
    height: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-btns {
    display: flex;
    gap: 0.6rem;
}

.modal-btns button {
    flex: 1;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: var(--hover-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--border-color);
}

.btn-confirm {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(107, 179, 217, 0.3);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 179, 217, 0.4);
}

.theme-toggle-btn {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9999;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(107, 179, 217, 0.15);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(107, 179, 217, 0.25);
}

.code-block {
    margin: 1.8rem 0;
    border-radius: var(--radius-lg);
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-family: monospace;
}

.code-lang {
    color: var(--primary-dark);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copy-btn:hover {
    background-color: rgba(107, 179, 217, 0.1);
    color: var(--primary-color);
}

.copy-btn.copied {
    color: #27ae60;
}

.code-content {
    overflow-x: auto;
}

.code-content pre {
    margin: 0;
    padding: 1.2rem;
    background-color: var(--hover-bg);
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-content code {
    font-family: inherit;
}

.video-container {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.video-container iframe {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    display: block;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 20px rgba(107, 179, 217, 0.15);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.video-container iframe:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 28px rgba(107, 179, 217, 0.25);
}

.bilibili-video {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    font-weight: 600;
    margin: 20px 0;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(107, 179, 217, 0.3);
}

.bilibili-video:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(107, 179, 217, 0.4);
}

.comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.comments-section h3 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

.comments-list {
    margin-top: 1rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item:hover {
    background: var(--hover-bg);
    margin: 0 -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
    border-radius: var(--radius-md);
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.user-title-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 6px;
    vertical-align: middle;
}

.comment-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.comment-delete {
    color: #e74c3c;
    font-size: 0.85rem;
    text-decoration: none;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.comment-delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

.comment-report {
    color: var(--text-light);
    font-size: 0.85rem;
    text-decoration: none;
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.comment-report:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.comment-content {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.6;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.no-comments {
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
    background: var(--hover-bg);
    border-radius: var(--radius-md);
}

.comment-form {
    margin-bottom: 1.5rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--hover-bg);
    color: var(--text-color);
    outline: none;
    transition: all var(--transition-fast);
}

.comment-form textarea:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(107, 179, 217, 0.1);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(107, 179, 217, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 179, 217, 0.4);
}

.login-prompt {
    color: var(--text-light);
    text-align: center;
    padding: 1.5rem;
    background: var(--hover-bg);
    border-radius: var(--radius-md);
}

.login-prompt a {
    color: var(--primary-color);
    font-weight: 600;
}

.login-prompt a:hover {
    color: var(--primary-dark);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 420px;
    padding: 0;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.2s ease-out;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-dark);
}

.modal-close {
    font-size: 22px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal form {
    padding: 24px;
}

.modal .form-group {
    margin-bottom: 18px;
}

.modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    box-sizing: border-box;
    transition: all var(--transition-fast);
    background: var(--hover-bg);
    color: var(--text-color);
    outline: none;
}

.modal .form-group select:focus,
.modal .form-group textarea:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(107, 179, 217, 0.1);
}

.modal .form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal .btn-danger {
    flex: 1;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.modal .btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.modal .btn-secondary {
    flex: 1;
    background: var(--hover-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.modal .btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-color);
}

@media (max-width: 992px) {
    .post-detail-container {
        grid-template-columns: 1fr;
    }

    .post-tags-sidebar, .post-attachments {
        position: static;
    }

    .post-tags-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .post-content {
        padding: 1.5rem 1rem;
    }

    .post-title {
        font-size: 1.6rem;
    }

    .theme-toggle-btn {
        left: 15px;
        bottom: 15px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .video-container iframe {
        border-radius: var(--radius-md);
    }

    .video-container iframe:hover {
        transform: none;
    }

    .comment-item:hover {
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

body.dark-mode {
    --bg-color: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-color: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border-color: #334155;
    --hover-bg: #334155;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body.dark-mode .post-content,
body.dark-mode .attachment-card,
body.dark-mode .modal-box,
body.dark-mode .modal-content {
    background: var(--surface-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .post-title {
    color: var(--text-color);
}

body.dark-mode .post-meta {
    color: var(--text-light);
}

body.dark-mode .post-body {
    color: var(--text-color);
}

body.dark-mode .post-body h2 {
    color: var(--primary-light);
}

body.dark-mode .attachment-name {
    color: var(--text-color);
}

body.dark-mode .attachment-size {
    color: var(--text-light);
}

body.dark-mode .attachment-item,
body.dark-mode .post-tag-item {
    background: var(--hover-bg);
    border-color: var(--border-color);
}

body.dark-mode .back-home {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

body.dark-mode .modal-box input {
    background: var(--hover-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .theme-toggle-btn {
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-mode .code-block {
    background-color: var(--hover-bg);
    border-color: var(--border-color);
}

body.dark-mode .code-header {
    background-color: var(--surface-color);
    border-bottom-color: var(--border-color);
}

body.dark-mode .code-lang {
    color: var(--primary-light);
}

body.dark-mode .copy-btn {
    color: var(--text-light);
}

body.dark-mode .copy-btn:hover {
    color: var(--primary-light);
}

body.dark-mode .code-content pre {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

body.dark-mode .comment-author {
    color: var(--text-color);
}

body.dark-mode .comment-content {
    color: var(--text-color);
}

body.dark-mode .comment-form textarea {
    background: var(--hover-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .no-comments {
    background: var(--hover-bg);
}

body.dark-mode .login-prompt {
    background: var(--hover-bg);
}