/* =============================================================
   HTML 展厅 · 全局样式
   设计原则：清洁、干净、简洁
   ============================================================= */

:root {
    /* 极简黑白灰调色板 */
    --primary: #1a1d26;          /* 主操作 = 近黑 */
    --primary-hover: #000000;
    --primary-light: #f1f3f5;     /* 选中态浅灰底 */
    --bg: #fafafa;
    --card: #ffffff;
    --text: #1a1d26;
    --text-2: #4a5064;
    --muted: #9aa0ac;
    --border: #ececf0;
    /* 强调色全部降为灰阶，仅危险/成功保留语义色 */
    --like: #1a1d26;
    --like-light: #f1f3f5;
    --forward: #1a1d26;
    --forward-light: #f1f3f5;
    --view: #4a5064;
    --download: #4a5064;
    --warn: #6b7280;
    --danger: #dc2626;
    --code-bg: #1a1d26;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(26, 29, 48, .04);
    --shadow-hover: 0 4px 16px rgba(26, 29, 48, .08);
    --header-h: 56px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, iframe { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

::selection { background: rgba(59, 108, 255, .18); }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1200px; margin: 0 auto; height: 100%;
    display: flex; align-items: center; gap: 28px; padding: 0 24px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.logo-mark {
    width: 30px; height: 30px; border-radius: 8px;
    background: #1a1d26;
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    font-family: Consolas, monospace;
}
.logo-text { color: var(--text); }
.nav { display: flex; gap: 4px; }
.nav a {
    padding: 7px 14px; border-radius: 9px; font-size: 14px; color: var(--text-2);
    font-weight: 500; transition: all .18s;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary-light); color: var(--primary); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid transparent; border-radius: 10px;
    padding: 7px 12px; width: 220px; transition: all .2s;
}
.header-search:focus-within { border-color: var(--primary); background: #fff; }
.header-search svg { color: var(--muted); flex-shrink: 0; }
.header-search input { border: none; outline: none; background: none; width: 100%; font-size: 14px; color: var(--text); }
.header-search input::placeholder { color: var(--muted); }
.admin-entry {
    display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
    color: var(--text-2); border: 1px solid var(--border); border-radius: 9px;
    padding: 7px 13px; transition: all .18s; background: #fff; flex-shrink: 0;
}
.admin-entry:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- 主体布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.main { min-height: calc(100vh - var(--header-h) - 120px); padding-bottom: 60px; }

/* ---------- 首页 Hero ---------- */
.hero { padding: 46px 0 26px; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; color: var(--text); }
.hero h1 .accent { color: var(--text); }
.hero p { color: var(--muted); font-size: 15px; max-width: 560px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-stat {
    display: flex; align-items: center; gap: 8px; background: #fff;
    border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px;
    font-size: 13px; color: var(--text-2);
}
.hero-stat b { font-size: 15px; color: var(--text); font-weight: 700; }
.hero-stat .dot { width: 6px; height: 6px; border-radius: 50%; background: #c8ccd4; }

/* ---------- 工具栏（排序 / 标签 / 结果数） ---------- */
.toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 16px 0 14px; position: sticky; top: var(--header-h); z-index: 50;
    background: var(--bg);
}
.sort-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--text-2);
    background: #fff; border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 14px; transition: all .15s;
}
.sort-toggle:hover { border-color: var(--text); color: var(--text); }
.sort-toggle .caret { transition: transform .2s; }
.sort-toggle.open .caret { transform: rotate(180deg); }
.sort-pills {
    display: flex; gap: 6px; background: #fff; border: 1px solid var(--border);
    border-radius: 11px; padding: 4px;
    max-height: 44px; overflow: hidden;
    transition: max-height .25s ease, opacity .2s ease, padding .2s;
}
.sort-pills:not(.open) {
    max-height: 0; opacity: 0; padding: 0; border-color: transparent;
    pointer-events: none;
}
.sort-pills button {
    font-size: 13px; font-weight: 500; color: var(--text-2);
    padding: 6px 13px; border-radius: 8px; transition: all .16s; white-space: nowrap;
}
.sort-pills button:hover { color: var(--text); }
.sort-pills button.active { background: var(--text); color: #fff; }
.result-count { font-size: 13px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 18px; }
.tag-chip {
    font-size: 12.5px; color: var(--text-2); background: #fff; border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 13px; transition: all .16s;
}
.tag-chip:hover { border-color: var(--text); color: var(--text); }
.tag-chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.tag-chip .n { opacity: .65; font-size: 11.5px; margin-left: 3px; }

/* ---------- 作品卡片网格 ---------- */
.grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    transition: transform .22s ease, box-shadow .22s ease;
    cursor: pointer; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-preview {
    position: relative; aspect-ratio: 16 / 10; overflow: hidden;
    background: linear-gradient(135deg, var(--c1, #dfe6ff), var(--c2, #efe4ff));
}
.card-preview iframe {
    /* 用 400% 尺寸 + scale(.25) 精确铺满容器：固定 1200px 宽在宽卡片上会留白 */
    width: 400%; height: 400%; border: 0;
    max-width: none;  /* 覆盖全局 img,iframe{max-width:100%}，否则会被缩回 1/4 */
    position: absolute; left: 50%; top: 0;
    transform: translate(-50%, 0) scale(0.25);
    transform-origin: top center;
    pointer-events: none; opacity: 0;
    transition: opacity .4s; background: #fff;
}
.card-preview iframe.loaded { opacity: 1; }
.card-preview .tile {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; color: rgba(26,29,48,.38);
    transition: opacity .3s;
}
.card-preview .tile.hide { opacity: 0; }
.card-preview .tile .ext {
    font-family: Consolas, monospace; font-size: 12px; font-weight: 700;
    background: rgba(255,255,255,.65); border-radius: 6px; padding: 2px 8px;
}
.pin-badge {
    position: absolute; top: 10px; left: 10px; z-index: 3;
    background: #1a1d26; color: #fff;
    font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
    display: flex; align-items: center; gap: 4px;
}
.draft-badge {
    position: absolute; top: 10px; right: 10px; z-index: 3;
    background: rgba(26,29,48,.72); color: #fff; font-size: 11.5px; font-weight: 600;
    border-radius: 999px; padding: 3px 10px;
}
.card-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 21px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tags .t { font-size: 11.5px; color: var(--primary); background: var(--primary-light); border-radius: 6px; padding: 2px 8px; }
.card-foot {
    display: flex; align-items: center; gap: 14px; margin-top: auto;
    padding-top: 10px; border-top: 1px solid #f1f2f7; font-size: 12.5px; color: var(--muted);
}
.card-foot .stat { display: flex; align-items: center; gap: 4px; }
.card-foot .stat svg { width: 14px; height: 14px; }
.card-foot .stat.like { color: var(--like); }
.card-foot .stat.forward { color: var(--forward); }
.card-foot .time { margin-left: auto; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 36px 0 10px; }
.pagination button, .pagination .cur {
    min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
    background: #fff; font-size: 13.5px; color: var(--text-2); display: flex;
    align-items: center; justify-content: center; padding: 0 10px; transition: all .15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.pagination .cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 空状态 / 骨架屏 ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; margin-bottom: 14px; opacity: .5; }
.empty .t { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty .s { font-size: 13px; }
.skeleton {
    background: linear-gradient(90deg, #eef0f6 25%, #f7f8fc 50%, #eef0f6 75%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sk-card .sk-prev { aspect-ratio: 16/10; }
.sk-card .sk-body { padding: 16px; display: grid; gap: 10px; }

/* ---------- 详情页 ---------- */
.detail-head { padding: 36px 0 20px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.crumb a:hover { color: var(--primary); }
.detail-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; }
.detail-title svg { width: 26px; height: 26px; vertical-align: -3px; margin-right: 4px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.detail-desc { margin-top: 14px; color: var(--text-2); font-size: 14.5px; max-width: 760px; white-space: pre-wrap; word-break: break-word; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.detail-tags .t {
    font-size: 12.5px; color: var(--primary); background: var(--primary-light);
    border-radius: 999px; padding: 4px 13px; cursor: pointer; transition: all .15s;
}
.detail-tags .t:hover { background: var(--primary); color: #fff; }

.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 22px; }
.stat-box {
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 20px; display: flex; align-items: center; gap: 10px; min-width: 108px;
}
.stat-box svg { width: 18px; height: 18px; }
.stat-box .v { font-size: 19px; font-weight: 800; line-height: 1.1; }
.stat-box .k { font-size: 12px; color: var(--muted); }
.stat-box.c-like svg { color: var(--like); }
.stat-box.c-forward svg { color: var(--forward); }
.stat-box.c-view svg { color: var(--view); }
.stat-box.c-download svg { color: var(--download); }
.stat-box.c-comment svg { color: var(--warn); }

.action-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-size: 14px; font-weight: 600; border-radius: 11px; padding: 10px 18px;
    transition: all .18s; border: 1px solid transparent; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-like { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-like:hover { border-color: var(--like); color: var(--like); }
.btn-like.liked { background: var(--like); border-color: var(--like); color: #fff; box-shadow: 0 4px 14px rgba(244,63,94,.35); }
.btn-forward { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-forward:hover { border-color: var(--forward); color: var(--forward); }
.btn-forward.done { background: var(--forward); border-color: var(--forward); color: #fff; box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.btn-fav { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-fav:hover { border-color: var(--warn); color: var(--warn); }
.btn-fav.faved { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs button {
    font-size: 14px; font-weight: 500; color: var(--muted); padding: 10px 16px;
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap; flex-shrink: 0;
}
.tabs button svg { width: 16px; height: 16px; flex-shrink: 0; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 预览框 */
.preview-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.preview-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: #f8f9fc; border-bottom: 1px solid var(--border);
}
.preview-bar .dots { display: flex; gap: 6px; margin-right: 6px; }
.preview-bar .dots i { width: 10px; height: 10px; border-radius: 50%; }
.preview-bar .dots i:nth-child(1) { background: #ff5f57; }
.preview-bar .dots i:nth-child(2) { background: #febc2e; }
.preview-bar .dots i:nth-child(3) { background: #28c840; }
.preview-bar .url {
    flex: 1; font-size: 12px; color: var(--muted); background: #fff;
    border: 1px solid var(--border); border-radius: 7px; padding: 4px 12px;
    font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-bar .acts { display: flex; gap: 4px; }
.icon-btn {
    width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; color: var(--text-2); transition: all .15s; border: 1px solid transparent;
}
.icon-btn:hover { background: #fff; border-color: var(--border); color: var(--primary); }
.icon-btn svg { width: 15px; height: 15px; }
.preview-frame { position: relative; height: 560px; background: #fff; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; }
/* 全屏的是 preview-wrap，所以内层预览区要跟着铺满 */
.preview-wrap:fullscreen,
.preview-wrap:-webkit-full-screen {
    display: flex; flex-direction: column;
    border: 0; border-radius: 0; background: #fff;
}
.preview-wrap:fullscreen .preview-frame,
.preview-wrap:-webkit-full-screen .preview-frame { flex: 1; height: auto; }
.preview-wrap:fullscreen .preview-bar,
.preview-wrap:-webkit-full-screen .preview-bar { flex-shrink: 0; }

/* 代码查看 */
.code-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.code-box {
    background: var(--code-bg); border-radius: 12px; overflow: auto; max-height: 560px;
    font-family: Consolas, "SF Mono", Monaco, "Courier New", monospace;
    font-size: 12.8px; line-height: 1.75;
}
.code-line { display: flex; }
.code-line:hover { background: rgba(255,255,255,.04); }
.code-line .no {
    flex-shrink: 0; width: 52px; padding-right: 14px; text-align: right;
    color: rgba(255,255,255,.25); user-select: none; position: sticky; left: 0;
    background: var(--code-bg);
}
.code-line .cd { white-space: pre; padding-right: 20px; color: #c9d4e8; }
.tok-t { color: #7dd3fc; }
.tok-a { color: #c4b5fd; }
.tok-s { color: #86efac; }
.tok-c { color: #64748b; font-style: italic; }

/* 评论区 */
.comment-form { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.comment-form .row { display: flex; gap: 10px; margin-bottom: 10px; }
.comment-form input[type=text] {
    width: 220px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px;
    font-size: 13.5px; outline: none; transition: border .15s; background: var(--bg);
}
.comment-form input[type=text]:focus { border-color: var(--primary); background: #fff; }
.comment-form textarea {
    width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
    font-size: 13.5px; outline: none; resize: vertical; min-height: 76px; background: var(--bg);
    transition: border .15s; font-family: inherit;
}
.comment-form textarea:focus { border-color: var(--primary); background: #fff; }
.comment-form .foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.comment-form .hint { font-size: 12px; color: var(--muted); margin-right: auto; }
.comment-list { display: grid; gap: 12px; }
.comment-item {
    background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
    display: flex; gap: 12px; animation: fadeIn .25s;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; font-weight: 700;
}
.comment-item .c-main { flex: 1; min-width: 0; }
.comment-item .c-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-item .c-name { font-size: 13.5px; font-weight: 600; }
.comment-item .c-time { font-size: 12px; color: var(--muted); }
.comment-item .c-text { font-size: 14px; color: var(--text-2); word-break: break-word; white-space: pre-wrap; }

/* ---------- 排行榜 ---------- */
.rank-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); padding: 36px 0; }
.rank-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.rank-card .rc-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15.5px;
}
.rank-card .rc-head svg { width: 18px; height: 18px; }
.rank-card.hot .rc-head svg { color: var(--text); }
.rank-card.likes .rc-head svg { color: var(--text-2); }
.rank-card.forwards .rc-head svg { color: var(--text-2); }
.rank-card.views .rc-head svg { color: var(--text-2); }
.rank-list { padding: 8px; }
.rank-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 10px; cursor: pointer; transition: background .15s;
}
.rank-item:hover { background: var(--bg); }
.rank-no {
    width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; background: var(--bg); color: var(--muted);
    font-family: Consolas, monospace;
}
.rank-item.top1 .rank-no { background: #1a1d26; color: #fff; }
.rank-item.top2 .rank-no { background: #4a5064; color: #fff; }
.rank-item.top3 .rank-no { background: #9aa0ac; color: #fff; }
.rank-item .r-title { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-item .r-val { font-size: 13px; font-weight: 700; color: var(--text-2); font-family: Consolas, monospace; }

/* ---------- 收藏页 ---------- */
.fav-grid { padding: 36px 0; }

/* ---------- 底部 ---------- */
.site-footer {
    border-top: 1px solid var(--border); padding: 26px 0 30px; margin-top: 20px;
    background: #fff;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
    font-size: 13px; color: var(--muted);
}
.footer-inner .links { display: flex; gap: 16px; margin-left: auto; }
.footer-inner a:hover { color: var(--primary); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); z-index: 9999; display: grid; gap: 10px; justify-items: center; }
.toast {
    background: rgba(20, 23, 34, .92); color: #fff; font-size: 13.5px;
    border-radius: 10px; padding: 10px 20px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
    display: flex; align-items: center; gap: 8px; animation: toastIn .25s ease;
    max-width: 82vw;
}
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast.ok { background: rgba(16, 163, 74, .95); }
.toast.err { background: rgba(220, 38, 38, .95); }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- 数据库未配置提示 ---------- */
.setup-notice {
    background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa;
    border-radius: var(--radius); padding: 26px 28px; margin: 40px auto; max-width: 720px;
}
.setup-notice h2 { font-size: 17px; color: #9a3412; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.setup-notice h2 svg { width: 18px; height: 18px; flex-shrink: 0; }
.setup-notice p, .setup-notice li { font-size: 13.5px; color: #7c2d12; line-height: 1.9; }
.setup-notice ol { margin: 8px 0 0 20px; }
.setup-notice code { background: rgba(255,255,255,.75); border-radius: 5px; padding: 1px 7px; font-size: 12.5px; font-family: Consolas, monospace; }
.setup-notice .acts { margin-top: 16px; display: flex; gap: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .header-search { width: 150px; }
    .nav { display: none; }
    .preview-frame { height: 420px; }
    .detail-title { font-size: 22px; }
}
@media (max-width: 640px) {
    .header-inner { padding: 0 16px; gap: 12px; }
    .container { padding: 0 16px; }
    .header-search { display: none; }
    .hero { padding: 30px 0 18px; }
    .hero h1 { font-size: 24px; }
    .grid { grid-template-columns: 1fr; }
    .toolbar { position: static; }
    .sort-pills { width: 100%; overflow-x: auto; }
    .preview-frame { height: 320px; }
    .stat-row { gap: 8px; }
    .stat-box { padding: 10px 14px; min-width: 92px; }
    .footer-inner .links { margin-left: 0; }
    /* 手机端底部留出 tabbar 高度 */
    .main { padding-bottom: calc(72px + 30px); }
}

/* =============================================================
   UI 优化层（2026-10-17 极简黑白灰版）
   ============================================================= */

/* ---- 卡片 hover：克制的浮起 ---- */
.card {
    transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* ---- focus 可访问性 ---- */
:focus-visible {
    outline: 1.5px solid var(--text);
    outline-offset: 2px;
    border-radius: 6px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* ---- 美化滚动条 ---- */
.code-box::-webkit-scrollbar { width: 10px; height: 10px; }
.code-box::-webkit-scrollbar-track { background: transparent; }
.code-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 6px; }
.code-box::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* ---- 移动端底部 Tab Bar（极简黑白灰） ---- */
.mobile-tabbar {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-tabbar-inner {
    display: grid; grid-template-columns: repeat(3, 1fr);
    max-width: 480px; margin: 0 auto;
    height: 56px;
}
.m-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: 10.5px; font-weight: 500;
    transition: color .15s;
    position: relative;
}
.m-tab svg { width: 20px; height: 20px; stroke-width: 1.8; }
.m-tab.active { color: var(--text); }
.m-tab.active::before {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 2px; background: var(--text); border-radius: 0 0 2px 2px;
}

@media (max-width: 640px) {
    .mobile-tabbar { display: block; }
    /* 给 main 和 footer 都留出 tab bar 高度，避免遮挡 */
    .main { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 24px) !important; }
    .site-footer { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 20px); }
}

/* ---- 空状态 ---- */
.empty {
    background: #fff; border: 1px dashed var(--border);
    border-radius: var(--radius); margin: 24px 0;
}

/* ---- 排序 pills 隐藏横向滚动条 ---- */
.sort-pills::-webkit-scrollbar { display: none; }
.sort-pills { scrollbar-width: none; }

/* ---- 手机端：搜索保留在顶栏，页签可横向滚动 ---- */
@media (max-width: 640px) {
    .header-search {
        display: flex; width: auto; flex: 1; min-width: 0; padding: 6px 10px;
    }
    .header-search input { font-size: 13px; }
    .admin-entry { padding: 7px 10px; }
    .admin-entry-text { display: none; }

    .tabs { overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tabs button { padding: 10px 12px; font-size: 13.5px; }

    /* toast 不要压到底部 Tab Bar 上 */
    .toast-wrap { bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 16px); }
}

