/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== CSS 变量：亮色主题 ===== */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --primary-color: #2563eb;
    --primary-light: #dbeafe;
    --border-color: #e5e7eb;
    /* 卡片不透明度由后台设置写入 --card-alpha（0~1） */
    --card-alpha: 1;
    --card-bg: rgba(249, 250, 251, var(--card-alpha));
    --tag-bg: #e0e7ff;
    --tag-text: #3730a3;
    --code-bg: #1e293b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --max-width: 800px;
}

/* ===== CSS 变量：暗色主题 ===== */
[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --text-light: #94a3b8;
    --primary-color: #60a5fa;
    --primary-light: #1e3a5f;
    --border-color: #334155;
    --card-bg: rgba(30, 41, 59, var(--card-alpha, 1));
    --tag-bg: #312e81;
    --tag-text: #a5b4fc;
    --code-bg: #0d1117;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* 暗色模式渐变兜底（无自定义背景图时显示在 html 上） */
[data-theme="dark"] {
    background: linear-gradient(135deg, #0f172a 0%, #1a1a2e 40%, #16213e 100%);
    background-attachment: fixed;
}

/* ===== 基础样式 ===== */
/* 浅色兜底底色与背景蒙层基色保持一致（#f5f6fa），
   避免主题切换的合成瞬间露出纯白造成"曝光" */
html {
    background-color: #f5f6fa;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: transparent;
    color: var(--text-color);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 自定义页面背景图（后台配置后由 JS 加 class 和变量）。
   同一张图：浅色模式浅色蒙层、深色模式暗色蒙层，保证文字可读 */
body.page-has-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(245, 246, 250, var(--overlay-alpha-light, 0.50)),
                        rgba(245, 246, 250, var(--overlay-alpha-light, 0.50))),
        var(--page-bg-image);
    background-size: cover;
    background-position: center center;
    z-index: -1;
    pointer-events: none;
}
[data-theme="dark"] body.page-has-bg::before {
    background-image:
        linear-gradient(rgba(13, 17, 33, var(--overlay-alpha-dark, 0.65)),
                        rgba(13, 17, 33, var(--overlay-alpha-dark, 0.65))),
        var(--page-bg-image);
}

/* 主题切换：圆形展开过渡动画 */
/* 新旧快照都禁用 UA 默认动画（尤其 new 默认的 fade-in，
   否则会与 JS 的 clip-path 叠加，圆形区域内新旧页面半透明混合产生泛白曝光） */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
    /* 快照合成缝隙的兜底底色，与页面真实底色一致，避免露出纯白 */
    background: #f5f6fa;
}
:root[data-theme="dark"]::view-transition-old(root),
:root[data-theme="dark"]::view-transition-new(root) {
    background: #0f172a;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 9999;
}

/* 回退方案：clip-path 覆盖层 */
.theme-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ===== 布局容器 ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ===== 页头 ===== */
.site-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
}

.logo:hover {
    text-decoration: none;
    color: var(--primary-color);
}

.nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-light);
    font-size: 0.95rem;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-color);
    text-decoration: none;
}

.nav-link.active {
    color: var(--text-color);
    border-bottom-color: var(--primary-color);
}

/* ===== 主题切换按钮 ===== */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-color);
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ===== Hero 区域 ===== */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    margin-top: 20px;
}

/* 头图背景层：已移除，hero 区域直接透出页面背景图 */
.hero::before {
    content: none;
}

/* 遮罩层：确保文字可读性（浓度由后台 --hero-alpha-* 控制，值越高遮罩越厚） */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, var(--hero-alpha-light, 0.82)) 0%,
        rgba(255, 255, 255, calc(var(--hero-alpha-light, 0.82) - 0.10)) 100%
    );
    z-index: 1;
}

/* 深色模式遮罩 */
[data-theme="dark"] .hero::after {
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, var(--hero-alpha-dark, 0.85)) 0%,
        rgba(22, 33, 62, calc(var(--hero-alpha-dark, 0.85) - 0.07)) 100%
    );
}

/* 内容层：确保在遮罩之上 */
.hero > * {
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.hero-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ===== 名言区域 ===== */
.quote-box {
    margin-top: 28px;
    padding: 20px 28px;
    border-left: 5px solid var(--primary-color);
    background: var(--card-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* 深色模式下名言卡片加边框轮廓，防止与渐变背景融合 */
[data-theme="dark"] .quote-box {
    border-left: 5px solid #60a5fa;
    box-shadow: 0 1px 6px rgba(96, 165, 250, 0.15);
    border-top: 1px solid rgba(96, 165, 250, 0.1);
    border-bottom: 1px solid rgba(96, 165, 250, 0.1);
    border-right: 1px solid rgba(96, 165, 250, 0.1);
}

.quote-box:hover {
    border-left-width: 7px;
    transform: translateX(3px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .quote-box:hover {
    box-shadow: 0 2px 12px rgba(96, 165, 250, 0.2);
}

.quote-text {
    font-size: 1.05rem;
    font-style: italic;
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 8px;
}

.quote-author {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: right;
}

/* ===== 刷新栏 ===== */
.refresh-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 8px;
}

.refresh-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    overflow: hidden;
}

.refresh-chip:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    background: transparent;
    color: var(--text-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.refresh-chip:hover .refresh-btn {
    color: var(--primary-color);
}

.refresh-btn::before {
    content: '↻';
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.4s ease;
    display: inline-block;
}

.refresh-btn:active {
    transform: scale(0.97);
}

.refresh-btn.refreshing {
    pointer-events: none;
    opacity: 0.7;
}

.refresh-btn.refreshing::before {
    animation: refresh-spin 0.6s ease-in-out;
}

@keyframes refresh-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.refresh-time {
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ===== 筛选器 ===== */
.filters {
    margin-bottom: 24px;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.filter-group {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-label {
    color: var(--text-light);
    font-size: 0.9rem;
    min-width: 50px;
    line-height: 2;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-light);
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    user-select: none;
}

.filter-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-tag.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ===== 文章列表 ===== */
.posts {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 60px;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* 置顶文章：左侧高亮边框 */
.post-card-pinned {
    border-left: 4px solid var(--primary-color);
}

.post-card-title {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.post-card-title a {
    color: var(--text-color);
}

.post-card-title a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.post-card-meta {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.post-card-summary {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-card-tag {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: var(--tag-bg);
    color: var(--tag-text);
}

/* ===== 文章详情页 ===== */
.article-detail {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    margin: 20px 0;
}

.article-detail h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.article-detail h2 {
    font-size: 1.5rem;
    margin: 32px 0 16px;
}

.article-detail h3 {
    font-size: 1.2rem;
    margin: 24px 0 12px;
}

.article-detail p {
    margin-bottom: 16px;
}

.article-detail ul,
.article-detail ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.article-detail li {
    margin-bottom: 8px;
}

.article-detail code {
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: "Fira Code", "Consolas", monospace;
}

.article-detail pre {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}

.article-detail pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-detail blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
    margin-bottom: 16px;
    color: var(--text-light);
}

.article-detail img {
    max-width: 100%;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.article-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.back-link {
    padding-bottom: 60px;
}

/* ===== 页脚 ===== */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    /* 独立实底色，保证版权与备案号在任何背景图/蒙层浓度下都清晰、不被盖住 */
    position: relative;
    z-index: 1;
    background: #ffffff;
}

[data-theme="dark"] .site-footer {
    background: #0f172a;
}

.site-footer p {
    color: var(--text-color);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
}

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

/* ===== 加载/空状态 ===== */
.loading,
.no-posts {
    text-align: center;
    color: var(--text-light);
    padding: 40px 0;
}

/* ===== 搜索框 ===== */
.search-box {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.search-box input {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.85rem;
    width: 240px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box button {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.search-box button:hover {
    opacity: 0.88;
}

/* ===== 分页导航 ===== */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 24px 0 32px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 38px;
    text-align: center;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--text-light);
    padding: 0 4px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
    padding: 6px 18px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
}

/* ===== 响应式：移动端 ===== */
@media (max-width: 640px) {
    .hero {
        padding: 40px 16px 24px;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .refresh-bar {
        flex-wrap: wrap;
    }

    .search-box {
        margin-left: 0;
        width: 100%;
    }

    .search-box input {
        flex: 1;
        width: auto;
    }

    .page-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .post-card {
        padding: 16px;
    }

    .post-card-title {
        font-size: 1.1rem;
    }

    .article-detail h1 {
        font-size: 1.5rem;
    }

    .article-detail h2 {
        font-size: 1.25rem;
    }

    .nav {
        gap: 16px;
    }

    .filter-label {
        min-width: 40px;
    }

    .editor-main {
        flex-direction: column !important;
    }

    .admin-textarea,
    .preview-panel {
        width: 100% !important;
    }
}

/* ===== 管理后台样式 ===== */
.admin-section {
    padding: 40px 0;
}

.login-form {
    display: flex;
    gap: 12px;
    max-width: 400px;
    margin: 24px 0;
}

.login-error {
    color: #ef4444;
    font-size: 0.9rem;
}

.admin-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s;
}

.admin-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.admin-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.admin-btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.admin-btn-primary:hover {
    background: #1d4ed8;
    color: #fff;
}

.admin-btn-danger {
    color: #ef4444;
    border-color: #ef4444;
}

.admin-btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

/* ===== 编辑器 ===== */
.editor-section {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.editor-row {
    display: flex;
    gap: 12px;
}

.editor-main {
    display: flex;
    gap: 12px;
}

.admin-textarea {
    width: 100%;
    min-height: 400px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: "Fira Code", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    background: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
}

.admin-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.preview-panel {
    display: none;
    width: 50%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    overflow-y: auto;
    max-height: 400px;
    line-height: 1.8;
}

.preview-panel h1,
.preview-panel h2,
.preview-panel h3 {
    margin: 16px 0 8px;
}

.preview-panel p {
    margin-bottom: 12px;
}

.preview-panel pre {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 12px;
}

.preview-panel code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

/* ===== 管理文章列表 ===== */
.post-list-section h2 {
    margin-bottom: 16px;
}

.admin-post-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.admin-post-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-post-title {
    font-weight: 500;
    color: var(--text-color);
}

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

/* ===== 图片上传区 ===== */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--card-bg);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 6px;
}

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

/* ===== 上传进度条 ===== */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.2s;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* ===== 上传状态反馈 ===== */
.upload-status {
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    display: none;
}

.upload-success {
    background: #d1fae5;
    color: #065f46;
    display: block !important;
}

[data-theme="dark"] .upload-success {
    background: #064e3b;
    color: #6ee7b7;
}

.upload-error {
    background: #fee2e2;
    color: #991b1b;
    display: block !important;
}

[data-theme="dark"] .upload-error {
    background: #7f1d1d;
    color: #fca5a5;
}

/* ===== 图片库 ===== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.image-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card-bg);
    transition: box-shadow 0.2s;
}

.image-card:hover {
    box-shadow: var(--shadow-hover);
}

.image-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    /* 高 DPI 屏幕优化 */
    image-rendering: -webkit-optimize-contrast;
}

.image-info {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.image-name {
    font-size: 0.8rem;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.image-size {
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
}

.image-card .admin-btn {
    flex: 1;
    border: none;
    padding: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.image-card .admin-btn:hover {
    opacity: 0.85;
}

/* 图片卡片操作按钮组 */
.image-actions {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color);
}

/* 「设为头图」按钮占满第二行 */
.image-actions .admin-btn-hero {
    flex: 1 1 100%;
    border-top: 1px solid var(--border-color);
}

/* 背景图设置面板 */
.bg-settings {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
}
.bg-settings h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}
.bg-tip {
    margin: 0 0 14px;
    font-size: 0.82rem;
    color: var(--text-light);
}
.bg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.bg-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bg-row label {
    font-size: 0.85rem;
    color: var(--text-color);
}
.bg-select {
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85rem;
    cursor: pointer;
}
.bg-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== 透明度调节面板 ===== */
.alpha-preview-wrap {
    margin-bottom: 14px;
}
.alpha-preview {
    height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}
.ap-hero {
    flex: 1.3;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    text-align: center;
    background-size: cover;
    background-position: center;
}
.ap-title {
    font-weight: 700;
    font-size: 0.9rem;
}
.ap-quote {
    font-size: 0.72rem;
    font-style: italic;
    padding: 6px 10px;
    text-align: left;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 6px 6px 0;
}
.ap-card {
    flex: 1;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ap-post-title {
    font-size: 0.82rem;
}
.ap-post-summary {
    font-size: 0.7rem;
    opacity: 0.8;
}
.ap-theme-switch {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.ap-theme-switch .ap-active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.alpha-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px 20px;
}
.alpha-row {
    display: grid;
    grid-template-columns: 1fr 46px;
    align-items: center;
    gap: 4px 10px;
}
.alpha-row label {
    grid-column: 1 / -1;
    font-size: 0.85rem;
}
.alpha-row input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: var(--primary-color);
}
.alpha-value {
    font-size: 0.82rem;
    color: var(--primary-color);
    text-align: right;
}
.alpha-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.image-actions .admin-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.image-actions .admin-btn-insert {
    background: var(--primary-color);
    color: #fff;
}

[data-theme="dark"] .image-actions .admin-btn-insert {
    background: #1d4ed8;
}

.image-actions .admin-btn-insert:hover {
    background: #1d4ed8;
}

[data-theme="dark"] .image-actions .admin-btn-insert:hover {
    background: #2563eb;
}

.admin-btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 重试按钮 */
.admin-btn-retry {
    background: #ef4444 !important;
    color: #fff !important;
    border: none !important;
    margin-left: 8px;
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
    vertical-align: middle;
}

.admin-btn-retry:hover {
    background: #dc2626 !important;
}

/* ===== 响应式图片（文章内容中） ===== */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    margin: 16px auto;
}

/* 高 DPI 屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero::before {
        background-size: cover;
        image-rendering: -webkit-optimize-contrast;
    }
}

/* 移动端图片库适配 */
@media (max-width: 640px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .image-card img {
        height: 110px;
    }

    .upload-area {
        padding: 28px 16px;
    }
}
