/* ════════════════════════════════════════════
   末路调色板 · 群相册样式
   ════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Noto+Serif+SC:wght@300;400;700&family=Bebas+Neue&display=swap');

/* ── Variables ── */
:root {
  --bg:        #0c0c0e;
  --bg2:       #111115;
  --surface:   #18181f;
  --border:    #272733;
  --text:      #e6e2da;
  --muted:     #6b6b7e;
  --c1: #ff6b6b; --c2: #ff9f43; --c3: #ffd93d;
  --c4: #6bcb77; --c5: #4d96ff; --c6: #c77dff;
  --radius: 14px;
  --ease: cubic-bezier(.22,1,.36,1);
  --shelf-w: 280px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Serif SC', serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ════════════════════════════════════════════
   PALETTE STRIPE
   ════════════════════════════════════════════ */
.palette-stripe {
  display: flex;
  height: 3px;
  width: 100%;
  position: fixed;
  top: 0; left: 0;
  z-index: 500;
}
.palette-stripe span { flex: 1; }

/* ════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════ */
header {
  position: sticky;
  top: 3px;
  z-index: 100;
  height: 60px;
  padding: 0 28px;
  background: rgba(12,12,14,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.logo-ring {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: conic-gradient(var(--c1),var(--c2),var(--c3),var(--c4),var(--c5),var(--c6),var(--c1));
  flex-shrink: 0;
  animation: hue-spin 8s linear infinite;
}
@keyframes hue-spin { to { filter: hue-rotate(360deg); } }

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700;
  letter-spacing: 0.04em;
  background: conic-gradient(var(--c1),var(--c2),var(--c3),var(--c4),var(--c5),var(--c6),var(--c1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hue-spin 8s linear infinite;
}

.header-stats { display: flex; align-items: center; gap: 18px; }

.stat-item { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

.stat-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 0.06em; color: var(--text);
}
.stat-label { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stat-divider { width: 1px; height: 26px; background: var(--border); }

/* ════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════ */
.hero { padding: 72px 28px 52px; text-align: center; user-select: none; }

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(48px, 9vw, 100px);
  font-weight: 900; line-height: 0.92; letter-spacing: -0.02em;
  background: conic-gradient(var(--c1),var(--c2),var(--c3),var(--c4),var(--c5),var(--c6),var(--c1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hue-spin 8s linear infinite;
}

.hero-sub {
  margin-top: 18px; font-size: 13px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}

/* ════════════════════════════════════════════
   SECTION
   ════════════════════════════════════════════ */
.section {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 700; letter-spacing: -0.01em;
}

.section-meta {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px; letter-spacing: 0.1em; color: var(--muted);
  flex: 1;
}

/* [可选功能] 排序按钮 */
.sort-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.sort-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text); }
.sort-btn.active { border-color: var(--c5); color: var(--c5); }

/* [可选功能] 搜索框 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 24px;
  color: var(--muted);
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  width: 100%;
}

.search-bar input::placeholder { color: var(--muted); }

/* ════════════════════════════════════════════
   ALBUMS GRID
   ════════════════════════════════════════════ */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
  animation: fade-up 0.5s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.album-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255,255,255,0.13);
  box-shadow: 0 20px 56px rgba(0,0,0,0.55);
}

.album-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg2);
}

.cover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 100%; gap: 2px;
}

.cover-thumb {
  background-size: cover;
  background-position: center;
  background-color: var(--bg2);
  transition: transform 0.55s ease;
}
.album-card:hover .cover-thumb { transform: scale(1.07); }

.cover-single {
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  background-color: var(--bg2);
  transition: transform 0.55s ease;
}
.album-card:hover .cover-single { transform: scale(1.05); }

.cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 55%);
  pointer-events: none;
}

.album-info { padding: 15px 17px 17px; }

.album-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700; line-height: 1.25; margin-bottom: 7px;
}

.album-footer { display: flex; justify-content: space-between; align-items: center; }
.album-date { font-size: 12px; color: var(--muted); }
.album-count { font-family: 'Bebas Neue', sans-serif; font-size: 13px; letter-spacing: 0.07em; color: var(--muted); }

.empty-state { grid-column: 1/-1; text-align: center; padding: 80px 24px; color: var(--muted); }
.empty-state svg { display: block; margin: 0 auto 16px; opacity: 0.25; }
.empty-state p { font-size: 14px; line-height: 1.8; letter-spacing: 0.04em; }

/* ════════════════════════════════════════════
   ALBUM VIEW
   ════════════════════════════════════════════ */
.album-view {
  position: fixed; inset: 0;
  z-index: 150;
  background: var(--bg);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.32s ease;
}
.album-view.open { opacity: 1; pointer-events: all; }

.album-view-header {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 14px;
  flex-shrink: 0;
  background: rgba(12,12,14,0.9);
  backdrop-filter: blur(20px);
}

.btn-back {
  display: flex; align-items: center; gap: 7px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 15px; border-radius: 8px;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif; font-size: 13px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-back:hover { background: var(--surface); border-color: rgba(255,255,255,0.18); }

.album-view-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.album-view-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px; letter-spacing: 0.1em; color: var(--muted);
  margin-left: auto; flex-shrink: 0;
}

.album-view-body { flex: 1; overflow-y: auto; padding: 24px; }

/* Masonry */
.masonry { columns: 4; column-gap: 12px; }
@media (max-width: 1100px) { .masonry { columns: 3; } }
@media (max-width: 680px)  { .masonry { columns: 2; } }

.photo-item {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  /* dragging */
  user-select: none;
}

.photo-item img { width: 100%; display: block; transition: transform 0.4s ease; pointer-events: none; }
.photo-item:hover img { transform: scale(1.03); }

.photo-hover {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.25s;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
}
.photo-item:hover .photo-hover { background: rgba(0,0,0,0.28); }
.photo-hover svg { opacity: 0; transition: opacity 0.25s; color: #fff; }
.photo-item:hover .photo-hover svg { opacity: 1; }

/* 拖动中状态 */
.photo-item.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  transition: opacity 0.15s, transform 0.15s;
}

/* 收纳盒高亮状态（拖到侧栏时） */
.shelf-drop-active {
  border-color: var(--c5) !important;
  background: rgba(77,150,255,0.06) !important;
}

/* ════════════════════════════════════════════
   LIGHTBOX — 按钮全部 fixed，不跟随图片
   ════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.96);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.lightbox.open { opacity: 1; pointer-events: all; }

/* 图片容器：只负责居中，不影响按钮位置 */
.lightbox-stage {
  display: flex; align-items: center; justify-content: center;
  max-width: 80vw;
  max-height: 85vh;
}
.lightbox-stage img {
  max-width: 80vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  user-select: none;
}

/* 关闭按钮 — 固定右上角 */
.lb-close {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 310;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lb-close:hover { background: rgba(255,255,255,0.22); }

/* 上一张 — 固定左侧中央 */
.lb-prev {
  position: fixed;
  left: 20px;
  top: 50%; transform: translateY(-50%);
  z-index: 310;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff;
  width: 48px; height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.lb-prev:hover { background: rgba(255,255,255,0.22); transform: translateY(-50%) scale(1.08); }

/* 下一张 — 固定右侧中央 */
.lb-next {
  position: fixed;
  right: 20px;
  top: 50%; transform: translateY(-50%);
  z-index: 310;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff;
  width: 48px; height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.lb-next:hover { background: rgba(255,255,255,0.22); transform: translateY(-50%) scale(1.08); }

.lb-counter {
  margin-top: 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px; letter-spacing: 0.15em;
  color: rgba(255,255,255,0.35);
}

/* ════════════════════════════════════════════
   收纳盒侧栏
   ════════════════════════════════════════════ */
.shelf {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  pointer-events: none; /* 子元素各自管理 */
}

/* 标签页（收起时可见） */
.shelf-tab {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.2s, border-color 0.2s;
  color: var(--muted);
}
.shelf-tab:hover { background: #22222e; color: var(--text); border-color: rgba(255,255,255,0.15); }

.shelf-tab-label {
  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: inherit;
}

.shelf-tab-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--c5);
  min-height: 16px;
}

/* 面板 */
.shelf-panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: var(--shelf-w);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  pointer-events: all;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease);
}

.shelf.open .shelf-panel { transform: translateX(0); }
.shelf.open .shelf-tab { opacity: 0; pointer-events: none; }

.shelf-header {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 10px;
  flex-shrink: 0;
}

.shelf-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700;
  flex: 1;
}

.shelf-actions { display: flex; align-items: center; gap: 6px; }

.shelf-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 7px;
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.shelf-btn:hover { background: #22222e; border-color: rgba(255,255,255,0.18); }

.shelf-btn-ghost {
  background: none;
  border-color: transparent;
  color: var(--muted);
  padding: 5px 8px;
}
.shelf-btn-ghost:hover { background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--text); }

/* 拖放提示区 */
.shelf-drop-zone {
  margin: 16px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.shelf-drop-zone svg { display: block; margin: 0 auto 10px; opacity: 0.3; }
.shelf-drop-zone p { font-size: 12px; line-height: 1.7; }

/* 收纳照片网格 */
.shelf-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}

.shelf-photo {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: var(--surface);
}

.shelf-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.shelf-photo:hover img { transform: scale(1.06); }

.shelf-photo-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.shelf-photo:hover .shelf-photo-remove { opacity: 1; }

/* ════════════════════════════════════════════
   [可选功能] 右键菜单
   ════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 150px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  display: none;
  animation: fade-up 0.15s ease;
}
.ctx-menu.open { display: block; }

.ctx-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  background: none; border: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  text-align: left;
  transition: background 0.15s;
}
.ctx-item:hover { background: rgba(255,255,255,0.07); }

.ctx-divider { height: 1px; background: var(--border); margin: 4px 6px; }

/* ════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 28px 24px;
  font-size: 12px; color: var(--muted); letter-spacing: 0.06em;
}
footer strong {
  background: conic-gradient(var(--c1),var(--c2),var(--c3),var(--c4),var(--c5),var(--c6),var(--c1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hue-spin 8s linear infinite;
  font-weight: 400;
}

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 600px) {
  header { padding: 0 16px; }
  .logo-text { display: none; }
  .stat-label { display: none; }
  .albums-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .section { padding: 0 16px 60px; }
  .hero { padding: 52px 16px 40px; }
  .album-view-body { padding: 16px; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
  /* 侧栏在手机上全屏宽 */
  :root { --shelf-w: 100vw; }
  .shelf-tab { top: auto; bottom: 80px; transform: none; border-radius: 10px 10px 0 0; width: 56px; right: 16px; flex-direction: row; padding: 10px 12px; }
  .shelf-tab-label { writing-mode: horizontal-tb; }
}

@media (max-width: 360px) {
  .albums-grid { grid-template-columns: 1fr; }
}
