/* ---------- 成品展示库 ---------- */

.gallery-page {
  background:
    radial-gradient(950px 560px at 94% -8%, rgba(231, 189, 87, 0.3), transparent 62%),
    radial-gradient(820px 520px at -8% 24%, rgba(126, 154, 131, 0.28), transparent 58%),
    var(--paper);
}

.main-nav a.active { color: var(--ink); }
.main-nav a.active::after { transform: scaleX(1); }

.gallery-hero {
  position: relative;
  z-index: 1;
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 54px 40px 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 328px;
  align-items: center;
  gap: 58px;
}
.gallery-hero-copy { max-width: 820px; }
.gallery-hero h1 {
  margin: 0;
  font-size: clamp(40px, 4.9vw, 70px);
  font-weight: 800;
  line-height: 1.09;
  letter-spacing: -0.045em;
}
.gallery-hero h1 span {
  color: var(--accent);
  background: linear-gradient(180deg, transparent 68%, rgba(231, 189, 87, 0.4) 68%, rgba(231, 189, 87, 0.4) 93%, transparent 93%);
  padding-bottom: 0.04em;
}
.gallery-hero-copy > p {
  max-width: 610px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.9;
}
.gallery-hero-copy > p strong { color: var(--accent-deep); font-weight: 600; }
.gallery-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 13px 22px; margin-top: 25px; }

.gallery-cta {
  width: auto;
  min-height: 52px;
  padding: 9px 18px;
  border-radius: 999px;
  gap: 10px;
}
.gallery-cta svg { width: 17px; height: 17px; }
.gallery-cta > span { align-items: flex-start; }
.gallery-text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  border-bottom: 1px solid #d8c9b5;
  padding-bottom: 3px;
}
.gallery-text-link span { transition: transform 0.18s ease; }
.gallery-text-link:hover { color: var(--ink); }
.gallery-text-link:hover span { transform: translateX(3px); }

/* 隐私说明卡 */
.privacy-card {
  position: relative;
  justify-self: end;
  width: 308px;
  padding: 24px 23px 22px;
  border-radius: 18px 22px 16px 20px;
  background:
    radial-gradient(360px 220px at 100% 0, rgba(217, 93, 69, 0.2), transparent 65%),
    radial-gradient(280px 200px at 0 100%, rgba(126, 154, 131, 0.2), transparent 65%),
    var(--forest);
  color: #faf4e8;
  box-shadow: 0 28px 55px -32px rgba(31, 45, 39, 0.7);
  transform: rotate(1.6deg);
}
.privacy-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 86px;
  height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(231, 189, 87, 0.5);
  border-left: 1px dashed rgba(128, 96, 38, 0.25);
  border-right: 1px dashed rgba(128, 96, 38, 0.25);
  box-shadow: 0 2px 5px rgba(21, 32, 27, 0.18);
}
.privacy-card-head { display: flex; align-items: center; gap: 9px; color: #aab8ad; font-size: 8.5px; font-weight: 600; letter-spacing: 0.16em; }
.privacy-lock { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--butter); color: #3d4535; }
.privacy-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy-card h2 { margin: 20px 0 17px; font-family: var(--font-serif); font-size: 28px; font-weight: 700; line-height: 1.28; letter-spacing: -0.03em; color: #fff9ec; }
.privacy-list { display: flex; flex-direction: column; gap: 11px; margin: 0; padding: 0; list-style: none; }
.privacy-list li { display: flex; align-items: flex-start; gap: 8px; color: #c3ccc1; font-size: 10.5px; line-height: 1.65; }
.privacy-list i { display: grid; place-items: center; width: 16px; height: 16px; flex: none; margin-top: 1px; border-radius: 50%; background: rgba(231, 189, 87, 0.16); color: var(--butter); font-size: 9px; font-style: normal; }
.privacy-foot { margin: 19px 0 0; padding-top: 13px; border-top: 1px solid rgba(255, 249, 236, 0.13); color: #8e9c91; font-size: 9px; line-height: 1.65; }

/* 成品库外壳 */
.gallery-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 80px), 1400px);
  margin: 0 auto 74px;
  padding: 24px 26px 28px;
  border: 1px solid rgba(210, 196, 175, 0.85);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-lg);
}
.gallery-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: 32px 32px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--butter) 42%, var(--sage) 72%, var(--ink));
  opacity: 0.8;
}

.gallery-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 1.18fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 19px;
}
.gallery-stat { min-width: 0; padding: 2px 18px; border-left: 1px solid var(--line); }
.gallery-stat:first-child { border-left: 0; padding-left: 2px; }
.gallery-stat > span { display: block; color: var(--muted-light); font-size: 8px; font-weight: 700; letter-spacing: 0.12em; }
.gallery-stat strong { display: inline-block; margin-top: 7px; font-size: 29px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.gallery-stat small { margin-left: 5px; color: var(--muted); font-size: 9px; }
.gallery-stat-phrase { color: var(--accent); font-family: var(--font-serif); font-size: 22px !important; font-weight: 700 !important; letter-spacing: -0.02em !important; }
.gallery-stat-note { border-left: 1px solid var(--line); }

.gallery-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 2px 18px;
}
.gallery-toolbar h2 { margin: 0; font-family: var(--font-serif); font-size: 27px; font-weight: 700; letter-spacing: -0.03em; }
.gallery-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 9.5px; }
.sort-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #f4eee4; }
.sort-tabs button {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.sort-tabs button:hover { color: var(--ink); }
.sort-tabs button.active { background: var(--card); color: var(--ink); box-shadow: 0 3px 8px -5px rgba(53, 39, 22, 0.5); }

/* 作品网格 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.work-card {
  position: relative;
  min-width: 0;
  border: 1px solid #e6dccd;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 1px 0 #fff inset;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.work-card:hover { transform: translateY(-3px); border-color: #d9c4aa; box-shadow: 0 20px 35px -25px rgba(67, 49, 26, 0.55); }
.work-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.work-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 10px;
  background:
    radial-gradient(circle at 1px 1px, rgba(98, 75, 46, 0.1) 1px, transparent 1.2px) 0 0 / 15px 15px,
    #f3ecdf;
  overflow: hidden;
}
.work-media img,
.work-media canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  background: #f6f0e6;
  box-shadow: 0 7px 16px -13px rgba(60, 42, 20, 0.55);
  transition: transform 0.3s ease;
}
.work-card:hover .work-media canvas { transform: scale(1.015); }
.work-date {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(255, 252, 246, 0.88);
  color: var(--muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 5px rgba(50, 36, 18, 0.06);
}
.work-info { display: block; padding: 11px 12px 12px; }
.work-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; }
.work-like {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  padding: 3px 7px 3px 5px;
  border: 1px solid rgba(225, 211, 192, 0.85);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.9);
  color: #9c9182;
  font-size: 9px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 9px -7px rgba(54, 38, 18, 0.45);
  backdrop-filter: blur(4px);
  transition: color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.work-like .heart { font-size: 16px; line-height: 1; transform: translateY(-1px); }
.work-like:hover { color: var(--accent); transform: scale(1.05); }
.work-like.liked { color: var(--accent); }
.work-author { display: flex; align-items: center; gap: 5px; margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.work-avatar { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--avatar, #e7bd57); color: #fffdf8; font-size: 7px; font-weight: 700; }
.work-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; margin-top: 8px; color: var(--muted-light); font-size: 8px; font-variant-numeric: tabular-nums; }
.work-meta span + span::before { content: "·"; margin-right: 7px; color: #cbbda9; }

/* 空、错误、加载 */
.gallery-empty, .gallery-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 35px;
  text-align: center;
}
.gallery-empty h3, .gallery-error strong { margin: 12px 0 0; font-family: var(--font-serif); font-size: 22px; }
.gallery-empty p, .gallery-error p { max-width: 330px; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.gallery-empty-cta { width: auto; margin-top: 17px; padding: 11px 18px; border-radius: 999px; font-size: 11px; }
.empty-beads { display: flex; align-items: center; gap: 5px; transform: rotate(-5deg); }
.empty-beads i { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #f8f2e7 0 18%, transparent 20%), var(--c); box-shadow: inset 0 0 0 1px rgba(46, 34, 20, 0.12); }
.empty-beads i:nth-child(1) { --c: #d95d45; }
.empty-beads i:nth-child(2) { --c: #e7bd57; transform: translateY(-7px); }
.empty-beads i:nth-child(3) { --c: #7e9a83; }
.empty-beads i:nth-child(4) { --c: #278cc9; transform: translateY(-4px); }
.empty-beads i:nth-child(5) { --c: #d45496; }
.gallery-retry { margin-top: 15px; height: 34px; padding: 0 15px; border: 1px solid #d8c8b3; border-radius: 999px; background: #fffdf8; color: var(--ink-soft); font-size: 10px; }
.gallery-retry:hover { border-color: var(--accent); color: var(--accent-deep); }

.gallery-load-wrap { display: flex; justify-content: center; padding-top: 22px; }
.gallery-load-more {
  height: 40px;
  padding: 0 22px;
  border: 1px solid #d9c9b4;
  border-radius: 999px;
  background: #fffdf8;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  transition: all 0.18s ease;
}
.gallery-load-more:hover { border-color: var(--accent); color: var(--accent-deep); background: #fdf6ef; }

/* 骨架屏 */
.work-skeleton { border: 1px solid #e9dfd1; border-radius: 18px; background: var(--card); overflow: hidden; }
.skeleton-media { aspect-ratio: 1 / 1; background: linear-gradient(100deg, #f2eadf 30%, #faf5ed 45%, #f2eadf 60%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-line { height: 9px; margin: 12px; border-radius: 5px; background: #f1e9de; }
.skeleton-line.short { width: 45%; margin-top: -3px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* 作品详情 */
.work-dialog {
  width: min(96vw, 980px);
  max-width: 980px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px rgba(24, 34, 29, 0.6);
}
.work-dialog::backdrop { background: rgba(30, 40, 35, 0.56); backdrop-filter: blur(4px); }
.work-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 8.5px; font-weight: 700; letter-spacing: 0.14em; }
.work-dialog-body { min-height: 280px; }
.work-detail-status { display: grid; place-items: center; min-height: 320px; color: var(--muted); font-size: 11px; }
.work-detail-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr); }
.work-detail-media {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(circle at 1px 1px, rgba(98, 75, 46, 0.11) 1px, transparent 1.2px) 0 0 / 16px 16px,
    #f1e9dc;
  border-radius: 0 0 0 22px;
}
.work-detail-media img,
.work-detail-media canvas { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 35px -26px rgba(55, 38, 17, 0.6); background: #f6f0e6; }
.work-detail-info { display: flex; flex-direction: column; padding: 24px 24px 20px; max-height: 78vh; overflow-y: auto; }
.work-detail-kicker { color: var(--accent); font-size: 8px; font-weight: 700; letter-spacing: 0.14em; }
.work-detail-info h2 { margin: 7px 0 0; font-family: var(--font-serif); font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.035em; }
.work-detail-author { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 10px; }
.work-detail-author .work-avatar { width: 20px; height: 20px; font-size: 8px; }
.work-detail-note { margin: 14px 0 0; color: var(--ink-soft); font-size: 11.5px; line-height: 1.8; }
.work-detail-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 17px; border: 1px solid #e7dccd; border-radius: 10px; overflow: hidden; background: #e7dccd; }
.work-detail-meta div { padding: 9px 10px; background: #fbf7f0; }
.work-detail-meta span { display: block; color: var(--muted-light); font-size: 7.5px; }
.work-detail-meta strong { display: block; margin-top: 3px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.work-detail-colors-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 7px; color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; }
.work-detail-colors-title span { color: var(--muted-light); font-size: 8.5px; font-weight: 400; letter-spacing: 0; }
.work-detail-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; max-height: 160px; overflow-y: auto; padding-right: 3px; scrollbar-width: thin; }
.detail-color-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.detail-color-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fffaf1 0 17%, transparent 19%), var(--c); box-shadow: inset 0 0 0 1px rgba(45, 32, 18, 0.13); }
.detail-color-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; }
.detail-color-count { margin-left: auto; color: var(--muted); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.work-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 17px; }
.work-detail-actions button, .work-detail-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid #e2d6c5;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 500;
  transition: all 0.18s ease;
}
.work-detail-actions button:hover, .work-detail-actions a:hover { border-color: #d5ab97; color: var(--accent-deep); background: #fdf6ef; }
.work-detail-actions .primary-action { flex: 1; border-color: var(--accent); background: var(--accent); color: #fffdf8; }
.work-detail-actions .primary-action:hover { background: var(--accent-deep); color: #fffdf8; }
.work-detail-actions .liked { border-color: rgba(217, 93, 69, 0.45); background: #fbece5; color: var(--accent-deep); }

/* 响应式 */
@media (max-width: 1240px) {
  .gallery-hero { padding-inline: 28px; gap: 36px; }
  .gallery-shell { width: calc(100% - 48px); padding-inline: 20px; }
  .gallery-grid { gap: 12px; }
}

@media (max-width: 1080px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-hero { grid-template-columns: minmax(0, 1fr) 300px; }
  .privacy-card { width: 288px; }
}

@media (max-width: 860px) {
  .gallery-hero { display: block; padding: 42px 20px 28px; }
  .gallery-hero h1 { font-size: clamp(38px, 8.8vw, 56px); }
  .gallery-hero-copy > p { font-size: 13.5px; }
  .privacy-card { width: auto; margin: 37px 0 0; transform: rotate(0.7deg); }
  .privacy-card h2 { font-size: 25px; margin-top: 15px; }
  .privacy-card h2 br { display: none; }
  .privacy-list { display: grid; grid-template-columns: 1fr; }
  .gallery-shell { width: calc(100% - 28px); padding: 17px 14px 22px; border-radius: 24px; margin-bottom: 52px; }
  .gallery-stats { grid-template-columns: 1fr 1fr; gap: 13px 0; padding-bottom: 14px; }
  .gallery-stat { padding: 1px 12px; }
  .gallery-stat:nth-child(2n + 1) { border-left: 0; padding-left: 2px; }
  .gallery-stat:nth-child(4) { border-left: 1px solid var(--line); }
  .gallery-stat strong { font-size: 24px; }
  .gallery-stat-phrase { font-size: 19px !important; }
  .gallery-toolbar { align-items: flex-start; flex-direction: column; padding: 19px 1px 14px; gap: 11px; }
  .gallery-toolbar h2 { font-size: 23px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .work-card { border-radius: 14px; }
  .work-media { padding: 7px; border-radius: 0; }
  .work-media canvas { border-radius: 8px; }
  .work-info { padding: 8px 9px 9px; }
  .work-title { font-size: 11px; }
  .work-like { top: 10px; right: 10px; padding: 2px 6px 2px 4px; }
  .work-like { font-size: 9px; }
  .work-like .heart { font-size: 14px; }
  .work-author { font-size: 8px; }
  .work-meta { font-size: 7.5px; gap: 3px 5px; margin-top: 6px; }
  .work-meta span + span::before { margin-right: 5px; }
  .work-date { top: 11px; left: 11px; font-size: 7px; }
  .sort-tabs button { height: 32px; font-size: 10px; }
  .work-dialog { width: 94vw; border-radius: 18px; }
  .work-dialog-body { max-height: 82vh; overflow-y: auto; }
  .work-detail-layout { display: block; }
  .work-detail-media { padding: 13px; border-radius: 0; }
  .work-detail-media canvas { max-height: 42vh; }
  .work-detail-info { max-height: none; overflow: visible; padding: 17px 16px 16px; }
  .work-detail-info h2 { font-size: 24px; }
  .work-detail-colors { max-height: 128px; grid-template-columns: 1fr 1fr; }
  .work-detail-actions { padding-top: 14px; }
  .work-detail-actions .primary-action { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .gallery-hero { padding: 34px 15px 24px; }
  .gallery-hero h1 { font-size: 37px; }
  .gallery-hero-copy > p { font-size: 12.5px; }
  .gallery-cta { min-height: 48px; padding-inline: 14px; }
  .gallery-cta > span { font-size: 11px; }
  .gallery-cta small { font-size: 8px; }
  .gallery-text-link { font-size: 10px; }
  .privacy-card { padding: 20px 18px 18px; }
  .privacy-card h2 { font-size: 23px; }
  .privacy-list li { font-size: 10px; }
  .gallery-shell { width: calc(100% - 20px); padding: 15px 11px 18px; }
  .gallery-stat { padding-inline: 9px; }
  .gallery-stat > span { font-size: 7px; }
  .gallery-stat strong { font-size: 22px; }
  .gallery-stat small { font-size: 8px; }
  .gallery-toolbar h2 { font-size: 21px; }
  .gallery-toolbar p { font-size: 8.5px; }
  .work-info { padding: 7px 8px 8px; }
  .work-title { font-size: 10.5px; }
  .work-like { top: 8px; right: 8px; }
  .work-author { gap: 4px; }
  .work-avatar { width: 13px; height: 13px; font-size: 6px; }
  .work-meta { font-size: 7px; }
  .work-like { gap: 1px; }
  .work-like .heart { font-size: 13px; }
  .work-dialog-head { padding: 11px 13px; }
  .work-detail-media { padding: 9px; }
  .work-detail-info { padding: 14px 13px 14px; }
  .work-detail-meta div { padding: 8px 7px; }
  .work-detail-actions button, .work-detail-actions a { height: 33px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-media { animation: none; }
}

@media (max-width: 860px) {
  .work-dialog[open] {
    display: flex;
    flex-direction: column;
    max-height: 92vh;
  }
  .work-dialog-head { flex: none; }
  .work-dialog-body {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .work-detail-media canvas { max-height: 38vh; }
}
