:root {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e4e9f2;
  --border-strong: #d3dbea;
  --text: #1b2333;
  --text-2: #5a6478;
  --text-3: #8a93a6;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-soft: #eef2ff;
  --ok: #0f9d68;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(23, 33, 56, .06), 0 1px 3px rgba(23, 33, 56, .04);
  --shadow: 0 4px 16px rgba(23, 33, 56, .07), 0 1px 3px rgba(23, 33, 56, .05);
  --shadow-lg: 0 18px 48px rgba(23, 33, 56, .16);
  --radius: 14px;
  --radius-lg: 20px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 460px at 12% -10%, #e7ecff 0%, rgba(231, 236, 255, 0) 62%),
    radial-gradient(820px 420px at 92% -6%, #e6f7f4 0%, rgba(230, 247, 244, 0) 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
}

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  color: var(--text);
  letter-spacing: -.2px;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, #8b5cf6 55%, #06b6d4 100%);
  display: grid; place-items: center;
  color: #fff; font-size: 15px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .32);
  flex: none;
}
.logo small {
  font-weight: 500;
  font-size: 11.5px;
  color: var(--text-3);
  border-left: 1px solid var(--border-strong);
  padding-left: 9px;
  margin-left: 2px;
}
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  transition: .18s;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--brand-soft); color: var(--brand); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #c3cddd; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .26);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%); }
.btn-danger { color: var(--danger); border-color: #f3c9c9; background: #fef5f5; }
.btn-danger:hover { background: #fdeaea; border-color: #eeb1b1; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .16s;
}
.input:focus, .select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .14); }

.section-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 20px;
}

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
}
.empty-icon { font-size: 40px; opacity: .5; margin-bottom: 10px; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 14px; }
.hero h1 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: -.8px;
}
.hero p { margin: 0; color: var(--text-2); font-size: 15.5px; max-width: 620px; }
.hero .badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.pill b { color: var(--brand); font-weight: 650; }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: .2s;
  position: relative;
  overflow: hidden;
}
.dropzone:hover { border-color: var(--brand-2); background: var(--surface); }
.dropzone.drag {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 3px rgba(79, 70, 229, .08);
}
.dropzone .dz-icon {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 25px;
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
  box-shadow: var(--shadow-sm);
}
.dropzone h3 { margin: 0 0 6px; font-size: 17px; }
.dropzone .hint { color: var(--text-3); font-size: 13.5px; margin: 0; }
.dropzone .hint kbd {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text-2);
}

/* ---------- 上传结果卡 ---------- */
.queue { display: grid; gap: 14px; margin-top: 18px; }
.item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: pop .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.item.error { border-color: #f3c9c9; background: #fffafa; }
.thumb {
  width: 96px; height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.item-name {
  font-weight: 600;
  font-size: 14px;
  word-break: break-all;
  margin-right: auto;
}
.fmt-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 3px 8px;
  border-radius: 7px;
  font-family: var(--mono);
}
.item-meta { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }

/* 格式链接区 */
.links { display: grid; gap: 8px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  transition: .16s;
}
.link-row:hover { border-color: var(--border-strong); background: #fff; }
.link-label {
  flex: none;
  width: 104px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.link-value {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  border: none;
  outline: none;
  padding: 0;
}
.link-note { font-size: 11.5px; color: var(--text-3); flex: none; }
.copy {
  flex: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: .16s;
}
.copy:hover { background: var(--brand-soft); color: var(--brand); border-color: #c7cdfa; }
.copy.done { background: #e7f8f0; color: var(--ok); border-color: #b9ead3; }
.toggle-links {
  background: none; border: none; color: var(--brand);
  font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; font-weight: 500;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-soft);
  overflow: hidden;
  margin-top: 8px;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), #8b5cf6);
  transition: width .2s;
  width: 0;
}
.progress.indeterminate > i { width: 40%; animation: indet 1s infinite linear; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* ---------- 统计条 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }
.stat .v {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }

.fmt-bars { display: grid; gap: 9px; }
.fmt-bar { display: grid; grid-template-columns: 58px 1fr 76px; gap: 10px; align-items: center; font-size: 12.5px; }
.fmt-bar .track { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.fmt-bar .track > i { display: block; height: 100%; border-radius: 99px; }
.fmt-bar .num { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 广场筛选栏 ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 18px 0;
  position: sticky;
  top: 74px;
  z-index: 20;
}
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: .16s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: #bcc7dd; background: var(--surface-2); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.chip .n { opacity: .72; font-size: 12px; font-variant-numeric: tabular-nums; }
.chip.active .n { opacity: .85; }
.grow { flex: 1; }
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: none;
  background: none;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-2);
  font-family: inherit;
}
.seg button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------- 图片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.grid.masonry {
  display: block;
  column-count: 4;
  column-gap: 14px;
}
.grid.masonry .tile { break-inside: avoid; margin-bottom: 14px; }
@media (max-width: 1000px) { .grid.masonry { column-count: 3; } }
@media (max-width: 720px) { .grid.masonry { column-count: 2; } }
@media (max-width: 460px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid.masonry { column-count: 2; } }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: .2s cubic-bezier(.2, .8, .3, 1);
  position: relative;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tile .pic {
  width: 100%;
  display: block;
  background: var(--bg-soft);
  object-fit: cover;
}
.grid:not(.masonry) .tile .pic { height: 170px; }
.tile-info { padding: 9px 11px 10px; display: flex; align-items: center; gap: 8px; }
.tile-info .t {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.tile .peek {
  position: absolute;
  inset: auto 0 46px 0;
  padding: 6px 10px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .45) 100%);
  opacity: 0;
  transition: .2s;
}
.tile:hover .peek { opacity: 1; }
.tile .peek button {
  border: none;
  background: rgba(255, 255, 255, .94);
  color: var(--text);
  border-radius: 7px;
  font-size: 11.5px;
  padding: 4px 9px;
  cursor: pointer;
  font-family: inherit;
}
.tile .peek button:hover { background: #fff; color: var(--brand); }

.load-more { text-align: center; padding: 26px 0 46px; }
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 21, 33, .72);
  backdrop-filter: blur(6px);
  display: none;
  padding: 28px;
  overflow: auto;
}
.lightbox.open { display: block; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lb-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}
@media (max-width: 900px) { .lb-inner { grid-template-columns: 1fr; } }
.lb-stage {
  background:
    repeating-conic-gradient(#f0f2f7 0% 25%, #fff 0% 50%) 50% / 22px 22px;
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 18px;
}
.lb-stage img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.lb-side { padding: 20px; max-height: 82vh; overflow: auto; }
.lb-close {
  position: absolute;
  top: 18px; right: 22px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .92);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
}
.lb-title { font-size: 15.5px; font-weight: 650; word-break: break-all; margin: 0 0 3px; }
.lb-sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; }
.lb-group { margin-bottom: 14px; }
.lb-group > h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  margin: 0 0 8px;
  font-weight: 700;
}
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  background: #1e2537;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
.toast.err { background: #b42318; }
.toast.ok { background: #0b7f56; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

footer.page-foot {
  padding: 30px 0 40px;
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

/* 格式配色 */
.f-jpg, .f-jpeg { background: #fdece9; color: #d0532d; }
.f-png { background: #e8f1fd; color: #2f6fd0; }
.f-gif { background: #f3e9fd; color: #8b46cf; }
.f-webp { background: #e6f6ef; color: #12855e; }
.f-avif { background: #e9f3fa; color: #1c6fa0; }
.f-svg { background: #fff3e0; color: #b76a00; }
.f-bmp, .f-tiff, .f-ico, .f-heic, .f-heif, .f-tga, .f-bin { background: #eceff5; color: #5a6478; }

.bar-jpg, .bar-jpeg { background: linear-gradient(90deg, #ef7d5a, #d0532d); }
.bar-png { background: linear-gradient(90deg, #6ea8f0, #2f6fd0); }
.bar-gif { background: linear-gradient(90deg, #b184ea, #8b46cf); }
.bar-webp { background: linear-gradient(90deg, #4fc79b, #12855e); }
.bar-avif { background: linear-gradient(90deg, #5cb3e0, #1c6fa0); }
.bar-svg { background: linear-gradient(90deg, #f0b64a, #b76a00); }
.bar-bmp, .bar-tiff, .bar-ico, .bar-heic, .bar-heif, .bar-tga, .bar-bin { background: linear-gradient(90deg, #b6bfd0, #7a8496); }
