:root {
  --bg: #f4f6f9;
  --bg-alt: #eceff3;
  --surface: #ffffff;
  --nav: #0f2b46;
  --nav-2: #16405f;
  --line: #dde3ea;
  --line-soft: #eaeef3;
  --text: #1b2430;
  --text-2: #5b6875;
  --text-3: #8b98a6;
  --brand: #0b63c5;
  --brand-dark: #084c99;
  --brand-soft: #e8f1fd;
  --accent: #e07b1a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
  --shadow-lg: 0 12px 40px rgba(10, 20, 32, .28);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: linear-gradient(120deg, var(--nav) 0%, var(--nav-2) 100%);
  color: #fff;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(10, 25, 40, .18);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 66px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f8ce8, #0b63c5);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.5px;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.logo-text b {
  display: block;
  font-size: 15px;
  letter-spacing: .3px;
  line-height: 1.25;
}

.logo-text span {
  display: block;
  font-size: 11.5px;
  color: #9fbcd8;
  line-height: 1.3;
}

.search {
  flex: 1;
  max-width: 460px;
  position: relative;
  margin-left: auto;
}

.search input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .1);
  border-radius: 20px;
  padding: 0 14px 0 38px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: .18s;
}

.search input::placeholder { color: #a8c1d8; }
.search input:focus {
  background: rgba(255, 255, 255, .17);
  border-color: rgba(255, 255, 255, .42);
}

.search svg {
  position: absolute;
  left: 13px;
  top: 11px;
  opacity: .75;
}

.stat {
  font-size: 12.5px;
  color: #b9cfe4;
  white-space: nowrap;
}
.stat b { color: #fff; font-size: 15px; }

/* ---------------- 筛选条 ---------------- */
.filters {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 66px;
  z-index: 40;
}

.filters-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  height: 31px;
  padding: 0 13px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.chip:hover { border-color: #b9c6d4; color: var(--text); }

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.chip.active:hover { background: var(--brand-dark); }

.chip .n {
  font-size: 11px;
  opacity: .8;
  background: rgba(0, 0, 0, .06);
  border-radius: 9px;
  padding: 1px 6px;
}
.chip.active .n { background: rgba(255, 255, 255, .22); }

/* ---------------- 主体 ---------------- */
.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 24px 70px;
}

/* ---------------- 上传区 ---------------- */
.uploader {
  border: 1.5px dashed #b9c8d9;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: 20px 22px;
  margin-bottom: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: .18s;
  position: relative;
}

.uploader:hover { border-color: var(--brand); background: #fff; }
.uploader.over {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 4px rgba(11, 99, 197, .08);
}
.uploader.busy { cursor: progress; opacity: .75; }
.uploader.off { cursor: default; opacity: .6; }

.up-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.up-t { font-size: 14.5px; color: var(--text); }
.up-t b { color: var(--brand); }
.up-s { font-size: 12.5px; color: var(--text-3); margin-top: 3px; line-height: 1.55; }

.up-status {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 6px;
  font-size: 12px;
  color: var(--brand);
  text-align: center;
  pointer-events: none;
}

.uploader.busy .up-status { display: block; }

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  background: #16293d;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  box-shadow: 0 8px 24px rgba(10, 20, 32, .3);
  max-width: 80vw;
}

.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #a3351f; }

/* ---------------- 我上传的标记 ---------------- */
.card.mine { border-color: #9dc0e8; }
.card.mine .thumb::after {
  content: "我的";
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
}

.del {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: .15s;
  display: grid;
  place-items: center;
}

.card:hover .del { opacity: 1; }
.del:hover { background: #c0392b; border-color: #c0392b; color: #fff; }

/* 我的图纸：页数徽章给删除按钮让位 */
.card.mine .pages { right: 38px; }

.sec { margin-bottom: 34px; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--line);
}

.sec-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: .2px;
}

.sec-head .tag {
  font-size: 11.5px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 600;
}

.sec-head .cnt {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 16px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: .18s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #c3d2e0;
}

.thumb {
  height: 176px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 8px;
}

.thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: .22s;
}

.card:hover .thumb img { transform: scale(1.04); }

.pages {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 43, 70, .82);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(3px);
}

.card-body { padding: 11px 13px 13px; }

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 39px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}

.code {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: 4px;
  padding: 0 5px;
  font-weight: 600;
  font-size: 11px;
}

.card-act {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  opacity: 0;
  transform: translateY(3px);
  transition: .18s;
}

.card:hover .card-act { opacity: 1; transform: none; }

.btn {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  height: 29px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: .15s;
  font-family: inherit;
}

.btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ---------------- 预留空白卡片 ---------------- */
.card.empty {
  border: 1.5px dashed #c2cede;
  background: repeating-linear-gradient(
      -45deg, #fafbfd, #fafbfd 9px, #f3f6fa 9px, #f3f6fa 18px);
  box-shadow: none;
  cursor: default;
  min-height: 252px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-3);
}

.card.empty:hover { transform: none; box-shadow: none; border-color: #a9bdd3; }

.card.empty .ph-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px dashed #b6c5d6;
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
  color: #a5b6c8;
}

.card.empty .ph-t { font-size: 13px; color: var(--text-2); font-weight: 600; }
.card.empty .ph-s { font-size: 11.5px; margin-top: 3px; padding: 0 12px; line-height: 1.5; }

/* ---------------- 空状态 ---------------- */
.none {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-3);
}
.none h3 { color: var(--text-2); margin: 0 0 6px; font-size: 15px; }

/* ---------------- 灯箱 ---------------- */
.lb {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 30, .82);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  flex-direction: column;
}

.lb.on { display: flex; }

.lb-top {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.lb-title { font-size: 15px; font-weight: 600; }
.lb-sub { font-size: 12px; color: #a9bdd0; }

.lb-top .sp { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.lb-btn {
  height: 31px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  transition: .15s;
}

.lb-btn:hover { background: rgba(255, 255, 255, .2); }

.lb-jump {
  width: 58px;
  height: 31px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 12.5px;
  text-align: center;
  font-family: inherit;
  outline: none;
}

.lb-jump:focus { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .5); }

.lb-btn.solid { background: var(--brand); border-color: var(--brand); }
.lb-btn.solid:hover { background: var(--brand-dark); }

.lb-body {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  padding: 20px 68px;
  overflow: auto;
}

.lb-body img {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .15s;
}

.lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-nav[disabled] { opacity: .22; cursor: default; }

/* ---------------- 页脚 ---------------- */
.foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 24px;
  color: var(--text-3);
  font-size: 12.5px;
}

.foot-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.foot b { color: var(--text-2); }

@media (max-width: 720px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 11px 0; gap: 11px; }
  .search { max-width: none; margin-left: 0; width: 100%; }
  .filters { top: 0; position: static; }
  .wrap { padding: 18px 14px 50px; }
  .filters-inner { padding: 10px 14px; }
  .lb-body { padding: 14px 12px 76px; }
  .lb-nav { top: auto; bottom: 14px; transform: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
  .thumb { height: 120px; }
}
