:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #7b8494;
  --line: #e8ebf0;
  --brand: #4f46e5;
  --brand-soft: #eef0ff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(24, 30, 48, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.header-right { display: flex; align-items: center; gap: 10px; }
.total-badge {
  font-size: 13px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.ghost-btn {
  font-size: 13px;
  color: var(--brand);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  transition: .18s;
}
.ghost-btn:hover { background: var(--brand-soft); border-color: #c7cbff; }

/* ---------- toolbar ---------- */
.toolbar { margin: 18px 0 14px; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #4a5262;
  transition: .18s;
}
.chip:hover { border-color: #c7cbff; color: var(--brand); }
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .28);
}
.chip i {
  font-style: normal;
  font-size: 11px;
  opacity: .7;
  background: rgba(0, 0, 0, .06);
  border-radius: 999px;
  padding: 1px 6px;
}
.chip.on i { background: rgba(255, 255, 255, .22); }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.search-box { display: flex; flex: 1 1 240px; min-width: 200px; }
.search-box input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 10px 0 0 10px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.search-box input:focus { border-color: #c7cbff; }
.search-btn {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 0 10px 10px 0;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.search-btn:hover { background: #4338ca; }
.sel {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 8px;
  font-size: 14px;
  color: #374151;
  outline: none;
}
.date-box { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.date-box .sel { width: 140px; }

/* ---------- grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(24, 30, 48, .12);
}
.card-img {
  aspect-ratio: 1 / 1;
  background: #f2f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .25s;
}
.card:hover .card-img img { transform: scale(1.03); }
.card-body { padding: 10px 12px 12px; }
.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.code {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 9px;
  cursor: pointer;
  transition: .18s;
}
.copy-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.copy-btn:hover { background: var(--brand); color: #fff; }
.copy-btn.done { background: #16a34a; color: #fff; }
.copy-btn.solid { padding: 7px 14px; font-size: 13px; }
.meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.meta .cat {
  background: #f1f3f7;
  border-radius: 6px;
  padding: 2px 7px;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- empty / load more ---------- */
.empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.load-more-wrap { text-align: center; margin: 24px 0 40px; }
.load-more {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 30px;
  font-size: 14px;
  color: var(--brand);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.load-more:hover { background: var(--brand-soft); }
.load-tip { display: block; margin-top: 10px; font-size: 12px; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
}

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; }
.lb-mask { position: absolute; inset: 0; background: rgba(15, 18, 28, .72); }
.lb-panel {
  position: relative;
  width: min(92vw, 900px);
  max-height: 92vh;
  margin: 4vh auto;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lb-close {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lb-img {
  background: #f2f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 66vh;
  overflow: auto;
}
.lb-img img { max-height: 66vh; width: auto; object-fit: contain; }
.lb-info { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.lb-code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lb-code { font-size: 17px; font-weight: 700; letter-spacing: .3px; word-break: break-all; }
.lb-meta { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.8; }
.lb-link { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--brand); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: rgba(24, 30, 48, .92);
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 120;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 12px; }
  .header-inner { height: 54px; }
  .brand { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 8px 10px 10px; }
  .code { font-size: 13px; }
  .copy-btn span { display: none; }
  .copy-btn { padding: 4px 7px; }
  .filters { gap: 8px; padding: 10px; }
  .date-box { width: 100%; }
  .date-box .sel { flex: 1; width: auto; }
  .sel { flex: 1 1 120px; }
  .lb-panel { width: 96vw; margin: 3vh auto; }
  .total-badge { display: none; }
}

/* ---------- 前台访问密码门 ---------- */
.gate-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #f6f7fb 0%, #eceefb 100%);
}

.gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px 24px;
  text-align: center;
}

.gate-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
}
.gate-icon svg {
  width: 28px; height: 28px;
  fill: none; stroke: var(--brand); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

.gate-title { font-size: 19px; margin: 0 0 6px; }
.gate-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.gate-err {
  background: #fdecec; color: #c0392b;
  border: 1px solid #f5c6c6; border-radius: 10px;
  font-size: 13px; padding: 8px 12px; margin-bottom: 14px;
}

.gate-form { display: flex; flex-direction: column; gap: 10px; }

.gate-input {
  width: 100%; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 14px; font-size: 15px;
  background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.gate-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.gate-btn {
  height: 44px; width: 100%;
  border: none; border-radius: 10px;
  background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.gate-btn:hover { background: #4338ca; }

.gate-tip { color: var(--muted); font-size: 12px; margin: 16px 0 0; }
