:root {
  --brand: #2f6fed;
  --brand-dark: #2458c4;
  --brand-soft: #eaf1ff;
  --ink: #182132;
  --ink-2: #46536a;
  --ink-3: #7a8699;
  --line: #e6e9ef;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --danger: #d93a3a;
  --success: #1f9d63;
  --warning: #b47708;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .04), 0 8px 24px rgba(20, 30, 50, .06);
  --shadow-sm: 0 1px 2px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.container { width: min(1200px, 92vw); margin: 0 auto; }
.container-narrow { width: min(860px, 92vw); margin: 0 auto; }

/* ---------- 顶栏 ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(47, 111, 237, .25);
}
.brand-mark svg { width: 19px; height: 19px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-size: 14px;
}
.nav a:hover { background: #f1f3f7; color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.header-space { flex: 1; }
.search-mini { position: relative; }
.search-mini input {
  width: 200px; padding: 8px 12px 8px 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #f8f9fb; outline: none;
}
.search-mini input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.search-mini svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  text-transform: uppercase;
}
.user-chip .name { font-size: 14px; color: var(--ink-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 14px; font-weight: 500; transition: .15s ease; white-space: nowrap;
}
.btn:hover { background: #f1f3f7; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: #d3d9e3; }
.btn-danger { color: var(--danger); border-color: #f1d4d4; background: #fff7f7; }
.btn-danger:hover { background: #fdeaea; color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 首页 ---------- */
.page { flex: 1; padding: 30px 0 60px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.intro h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.2px; }
.intro p { margin: 0; color: var(--ink-3); font-size: 14px; }
.stats { display: flex; gap: 26px; }
.stat b { font-size: 22px; font-weight: 700; display: block; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--ink-3); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fffdf3; border: 1px solid #f3e6bd; color: #7d5c07;
  padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 20px;
}

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 13.5px;
}
.chip:hover { border-color: #c9d3e6; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.select {
  padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); outline: none; font-size: 13.5px; color: var(--ink-2);
}

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #d9e0ec; }
.card-cover { position: relative; aspect-ratio: 16 / 9; background: #eef1f6; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(16, 24, 40, .62); color: #fff;
  font-size: 11.5px; padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(4px);
}
.badge.right { left: auto; right: 10px; }
.badge.lock { background: rgba(214, 138, 0, .85); }
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
  font-size: 13px; color: var(--ink-3); margin: 0; min-height: 40px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-3); margin-top: auto; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.meta-item svg { width: 14px; height: 14px; }
.card-owner { display: inline-flex; align-items: center; gap: 5px; }
.card-owner .avatar { width: 20px; height: 20px; font-size: 10px; }

.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 70px 20px; text-align: center; color: var(--ink-3);
}
.empty h3 { color: var(--ink-2); margin: 0 0 6px; font-size: 16px; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 34px; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13.5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .disabled { opacity: .45; }

/* ---------- 详情 ---------- */
.breadcrumb { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; display: flex; gap: 6px; align-items: center; }
.detail-top { display: grid; grid-template-columns: 1.55fr 1fr; gap: 26px; align-items: start; }
.detail-cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #eef1f6; }
.detail-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.detail-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.detail-panel h1 { margin: 0 0 8px; font-size: 23px; letter-spacing: -.2px; }
.detail-sub { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--ink-3); font-size: 13px; margin-bottom: 16px; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 500; }
.tag.gray { background: #f0f2f6; color: var(--ink-2); }
.tag.warn { background: #fff4e0; color: #a36a00; }
.tag.danger { background: #fdecec; color: var(--danger); }
.tag.success { background: #e8f7ef; color: var(--success); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 6px; }
.detail-stats { display: flex; gap: 22px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 16px; }
.detail-stats div b { display: block; font-size: 17px; }
.detail-stats div span { font-size: 12px; color: var(--ink-3); }

.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 24px; }
.section h2 { font-size: 17px; margin: 0 0 14px; }
.prose { color: var(--ink-2); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }

.comment { display: flex; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-main { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head b { font-weight: 600; }
.comment-head time { color: var(--ink-3); font-size: 12px; }
.comment-body { margin-top: 4px; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.comment-form textarea {
  width: 100%; min-height: 92px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); resize: vertical; outline: none; background: #fbfcfe;
}
.comment-form textarea:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .1); }

/* ---------- 表单 ---------- */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .textarea, .select-full {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: #fbfcfe; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select-full:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .1); }
.textarea { min-height: 110px; resize: vertical; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.file-drop {
  border: 1.5px dashed #cbd4e3; border-radius: 12px; padding: 26px; text-align: center;
  background: #fafbfd; color: var(--ink-3); cursor: pointer; transition: .15s;
}
.file-drop:hover, .file-drop.dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.file-drop strong { color: var(--ink); display: block; margin-bottom: 4px; }
.cover-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cover-preview {
  width: 240px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #eef1f6;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.type-options { display: flex; gap: 10px; flex-wrap: wrap; }
.type-option { position: relative; }
.type-option input { position: absolute; opacity: 0; }
.type-option span {
  display: inline-block; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fbfcfe; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.type-option input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------- 我的作品 / 表格 ---------- */
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-thumb { width: 96px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: #eef1f6; flex-shrink: 0; }
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-main { flex: 1; min-width: 0; }
.list-main h4 { margin: 0 0 3px; font-size: 15px; }
.list-main p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { background: #fafbfd; color: var(--ink-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fbfcfe; }
.table-empty { padding: 40px; text-align: center; color: var(--ink-3); }

/* ---------- 提示 ---------- */
.flash-wrap { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid; }
.flash.success { background: #eefaf3; border-color: #c6ebd8; color: #196c47; }
.flash.error { background: #fdf0f0; border-color: #f3cfcf; color: #a52626; }
.flash.warning { background: #fffaeb; border-color: #f1e2b3; color: #8a6100; }

/* ---------- 登录提示 / 等待 ---------- */
.center-card { max-width: 480px; margin: 8vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px; text-align: center; box-shadow: var(--shadow); }
.center-card h1 { font-size: 20px; margin: 18px 0 8px; }
.center-card p { color: var(--ink-3); font-size: 14px; margin: 0 0 20px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 后台 ---------- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.admin-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 84px; }
.admin-side a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.admin-side a:hover { background: #f4f6fa; color: var(--ink); }
.admin-side a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.admin-side .group { font-size: 11.5px; color: var(--ink-3); padding: 12px 12px 5px; letter-spacing: .5px; }
.admin-main h1 { font-size: 21px; margin: 0 0 4px; }
.admin-main .sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat-box b { font-size: 24px; display: block; line-height: 1.25; }
.stat-box span { font-size: 12.5px; color: var(--ink-3); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 15.5px; margin: 0 0 14px; }
.progress { height: 8px; border-radius: 99px; background: #eef1f6; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .38); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-mask.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 96vw); max-height: 88vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.user-results { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 12px; }
.user-result { padding: 10px 13px; display: flex; align-items: center; gap: 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.user-result:last-child { border-bottom: 0; }
.user-result:hover, .user-result.active { background: var(--brand-soft); }
.user-result .info { flex: 1; }
.user-result .info b { font-size: 13.5px; display: block; }
.user-result .info span { font-size: 12px; color: var(--ink-3); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0; color: var(--ink-3); font-size: 12.5px; }
.site-footer .inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 1080px) {
  .grid, .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .grid, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .detail-top { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; display: flex; flex-wrap: wrap; }
  .admin-side .group { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .search-mini { display: none; }
  .intro { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .grid, .grid.cols-3 { grid-template-columns: 1fr; }
  .header-inner { gap: 10px; height: 58px; }
  .nav { display: none; }
  .user-chip .name { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stats { gap: 18px; }
  .list-row { flex-wrap: wrap; }
  .detail-actions .btn { flex: 1; }
}
