/* ============================================================
   图片库 · 统一界面样式（自包含，不依赖任何 CDN）
   深色为主，系统偏好浅色时自动切换
   ============================================================ */

:root {
  --bg:        #0c1017;
  --bg-soft:   #111721;
  --surface:   #161d29;
  --surface-2: #1c2533;
  --line:      #26303f;
  --line-soft: #202a37;
  --text:      #e8eef7;
  --muted:     #8b9aae;
  --accent:    #5b8cff;
  --accent-2:  #7c6cff;
  --accent-ink:#ffffff;
  --ok:        #34c07a;
  --warn:      #e2a53d;
  --err:       #e46b6b;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 24px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --ring:      0 0 0 3px rgba(91, 140, 255, .25);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f5f7fb;
    --bg-soft:   #eef2f8;
    --surface:   #ffffff;
    --surface-2: #f7f9fc;
    --line:      #dfe6f0;
    --line-soft: #e9eef6;
    --text:      #1c2430;
    --muted:     #6b7a90;
    --shadow:    0 8px 24px rgba(20, 35, 60, .10);
    --shadow-sm: 0 2px 8px rgba(20, 35, 60, .07);
  }
}

* { box-sizing: border-box; }

html { scrollbar-color: #39465a transparent; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 12% -12%, rgba(91, 140, 255, .12), transparent 60%),
    radial-gradient(900px 460px at 88% -18%, rgba(124, 108, 255, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font: 14.5px/1.65 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #8fb0ff; }
code {
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  padding: 1px 6px; border-radius: 6px; font-size: 12.5px;
}
img { max-width: 100%; }

h1 { font-size: 23px; margin: 6px 0 16px; letter-spacing: .2px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.pad { padding: 18px; }

/* ------------------------------------------------------------ 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.brand { font-weight: 700; letter-spacing: .4px; white-space: nowrap; font-size: 15.5px; }
.brand a { color: inherit; }
.brand a:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px; border-radius: 999px; color: var(--muted);
  font-size: 13.5px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); box-shadow: var(--shadow-sm);
}
.user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

.wrap { max-width: 1300px; margin: 0 auto; padding: 22px 20px 72px; }
.foot {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 22px; border-top: 1px solid var(--line-soft);
}

/* ------------------------------------------------------------ 首页头部 */
.hero { margin: 6px 0 20px; }
.hero h1 {
  font-size: clamp(24px, 3.4vw, 34px); margin: 0 0 10px;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
}

/* ------------------------------------------------------------ 卡片/面板 */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
}
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ 表单 */
label { display: block; margin: 0 0 11px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; margin-top: 5px; padding: 9px 11px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.fieldset { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 8px; }
.radio, .check { display: flex; gap: 9px; align-items: flex-start; color: var(--text); font-size: 13.5px; }
.radio input, .check input { width: auto; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.filters {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 18px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.filters label { margin: 0; min-width: 150px; }
.filters .f-search { flex: 1 1 220px; }
.bulk-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.bulk-bar .mini { width: 150px; margin: 0; }
form.inline { display: inline; }
button.link {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  padding: 0; font-size: 12.5px; font-family: inherit;
}
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--err); }

/* ------------------------------------------------------------ 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); font-size: 13.5px; font-family: inherit;
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
  line-height: 1.2;
}
.btn:hover { background: var(--line-soft); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-sm);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.accent { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }
.btn.danger { background: color-mix(in srgb, var(--err) 22%, var(--surface)); border-color: color-mix(in srgb, var(--err) 45%, var(--line)); color: #ffdada; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ 提示 */
.alert { padding: 11px 15px; border-radius: var(--radius-sm); margin: 0 0 15px; font-size: 13.5px; border: 1px solid; }
.alert.ok    { background: color-mix(in srgb, var(--ok) 14%, var(--surface));   border-color: color-mix(in srgb, var(--ok) 42%, var(--line));   color: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.alert.warn  { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 42%, var(--line)); color: color-mix(in srgb, var(--warn) 78%, var(--text)); }
.alert.error { background: color-mix(in srgb, var(--err) 14%, var(--surface));  border-color: color-mix(in srgb, var(--err) 42%, var(--line));  color: color-mix(in srgb, var(--err) 78%, var(--text)); }

.pill {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; border: 1px solid var(--line); color: var(--muted);
  background: var(--surface-2); vertical-align: middle;
}
.pill.ok    { color: color-mix(in srgb, var(--ok) 80%, var(--text));   border-color: color-mix(in srgb, var(--ok) 45%, var(--line));   background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.pill.warn  { color: color-mix(in srgb, var(--warn) 82%, var(--text)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.pill.error { color: color-mix(in srgb, var(--err) 82%, var(--text));  border-color: color-mix(in srgb, var(--err) 45%, var(--line));  background: color-mix(in srgb, var(--err) 14%, var(--surface)); }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; margin: 0 2px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  color: var(--muted); font-size: 11.5px; transition: all .15s;
}
a.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------ 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat .num { display: block; font-size: 27px; font-weight: 700; letter-spacing: .3px; }
.stat .lbl { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------ 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 11px; border-bottom: 1px solid var(--line-soft);
  text-align: left; vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .3px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.cell-cover img { width: 76px; height: 46px; object-fit: cover; border-radius: var(--radius-sm); display: block; }

/* ------------------------------------------------------------ 作品卡片（前台） */
.card-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
}
.card-post {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  box-shadow: var(--shadow-sm);
}
.card-post:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-link { display: flex; flex-direction: column; color: inherit; flex: 1; }
.card-link:hover { text-decoration: none; }
.card-cover { position: relative; background: var(--bg-soft); }
.card-cover img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.badge {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  background: rgba(8, 12, 20, .72); color: #eaf0fb;
  backdrop-filter: blur(4px); border: 1px solid rgba(255, 255, 255, .12);
}
.card-body { padding: 11px 12px 6px; }
.card-title {
  font-size: 13.5px; line-height: 1.45; margin: 0; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.card-tags { padding: 0 12px 12px; display: flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------------------------ 通用缩略图网格（后台/相关推荐） */
.thumb-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.thumb {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text);
  transition: transform .18s, box-shadow .18s, border-color .18s; box-shadow: var(--shadow-sm);
}
.thumb:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: var(--bg-soft); }
.thumb-empty { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg-soft); }
.thumb-cap { padding: 10px 11px; }
.thumb-cap .t {
  font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thumb-cap .m { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* ------------------------------------------------------------ 图片网格（后台管理） */
.img-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); }
.cell { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cell img { width: 100%; height: 172px; object-fit: cover; display: block; background: var(--bg-soft); }
.cell figcaption { padding: 9px 11px; }
.cell .m { color: var(--muted); font-size: 11.5px; }
.cell .ops { margin-top: 7px; display: flex; gap: 11px; align-items: center; }
.cell .ops a, .cell .ops button { font-size: 12.5px; }

/* ------------------------------------------------------------ 相关推荐 */
.rec-title { margin: 22px 0 12px; color: var(--muted); font-weight: 600; font-size: 13.5px; letter-spacing: .3px; }
.recs { margin-top: 30px; }
.recs-head { font-size: 18px; margin: 0 0 6px; }
.recs-more { margin-top: 18px; }

/* ------------------------------------------------------------ 分页 / 面包屑 */
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 26px 0; }
.pager-info { color: var(--muted); font-size: 13px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .cur { color: var(--text); }

/* ------------------------------------------------------------ 步骤条 */
.steps { display: flex; gap: 9px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 9px; padding: 8px 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 13px;
}
.steps li .idx {
  width: 21px; height: 21px; border-radius: 50%; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.steps li.active { border-color: var(--accent); color: var(--text); box-shadow: var(--ring); }
.steps li.active .idx { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.steps li.done { color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.steps li.done .idx { background: color-mix(in srgb, var(--ok) 70%, var(--surface)); color: #fff; }

/* ------------------------------------------------------------ 登录 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 372px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 19px; text-align: center; margin: 0 0 20px; }
.login-card .btn { width: 100%; margin-top: 8px; }

/* ------------------------------------------------------------ 灯箱 */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 9, 14, .94); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 26px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 86vh; object-fit: contain; border-radius: var(--radius-sm); }
.lb-cap { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ 作品网页（观看页） */
.viewer {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.viewer-bar {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.viewer-title h1 { font-size: 17px; margin: 0 0 6px; }
.viewer-sub { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 12.5px; }
.viewer-sub .dot { opacity: .5; }
.viewer-sub .counter b { color: var(--text); }
.viewer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.viewer-stage {
  position: relative; background: #05070b;
  display: flex; align-items: center; justify-content: center; min-height: 60vh;
}
.viewer-stage img { max-width: 100%; max-height: 78vh; object-fit: contain; display: block; }
.vnav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 84px; border: 0; cursor: pointer;
  background: rgba(16, 22, 32, .62); color: #fff; font-size: 32px; line-height: 1;
  border-radius: 10px; backdrop-filter: blur(6px); transition: background .15s;
}
.vnav:hover { background: rgba(40, 56, 82, .88); }
.vnav.prev { left: 12px; }
.vnav.next { right: 12px; }
.viewer-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 9px 18px; border-top: 1px solid var(--line); font-size: 12.5px;
}
.viewer-foot .hint { font-size: 12px; opacity: .85; }
.status-line { margin: 0 0 8px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.viewer-strip { display: flex; gap: 7px; overflow-x: auto; padding: 12px 18px; border-top: 1px solid var(--line); }
.viewer-strip img {
  width: 74px; height: 54px; object-fit: cover; border-radius: var(--radius-sm);
  cursor: pointer; opacity: .5; border: 2px solid transparent; transition: opacity .15s, border-color .15s;
}
.viewer-strip img:hover { opacity: .85; }
.viewer-strip img.active { opacity: 1; border-color: var(--accent); }

/* 本地文件缺失时的资料卡（代替破图） */
.img-missing {
  width: 100%; min-height: 120px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px;
  background: repeating-linear-gradient(45deg,
    var(--surface-2), var(--surface-2) 10px, var(--bg-soft) 10px, var(--bg-soft) 20px);
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------ 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #39465a; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #4a5a72; background-clip: content-box; }
