* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: #000; color: #f5f5f7; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 200;
  background: rgba(0,0,0,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.topbar .back { color: #7c4dff; font-size: 13px; cursor: pointer; text-decoration: none; }
.topbar .title { font-size: 15px; font-weight: 600; color: #f5f5f7; }
.topbar .right { display: flex; gap: 10px; align-items: center; }
.tool-btn {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; border: none; border-radius: 10px;
  padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit;
}
.tool-btn:hover { filter: brightness(1.1); }
.tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.canvas-wrap { padding: 72px 28px 60px; min-height: 100vh; }
.canvas-head {
  margin-bottom: 20px; padding: 16px 22px;
  background: #1d1d1f; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; flex-wrap: wrap;
}
.canvas-head .info { font-size: 13px; color: #86868b; line-height: 1.8; }
.canvas-head .info b { color: #f5f5f7; font-weight: 500; margin-right: 6px; }

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

.shot-card {
  background: #1d1d1f; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
  display: flex; flex-direction: column;
  transition: all 0.2s;
}
.shot-card:hover { transform: translateY(-2px); border-color: rgba(124, 77, 255,0.3); }

.shot-image-wrap {
  position: relative; aspect-ratio: 16/9;
  background: #0d0d0f;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.shot-image-wrap.placeholder::before {
  content: '尚未生成'; color: #48484a; font-size: 13px;
}
.shot-image-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.shot-image-wrap .gen-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  color: #a78bfa; font-size: 12px;
}
.shot-image-wrap .gen-overlay .spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(167,139,250,0.2);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.shot-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.shot-header { display: flex; justify-content: space-between; align-items: center; }
.shot-id { font-size: 13px; font-weight: 600; color: #f5f5f7; }
.shot-meta { font-size: 11px; color: #86868b; }
.shot-desc { font-size: 12px; color: #d1d1d6; line-height: 1.55; max-height: 60px; overflow: hidden; }
.shot-prompt { font-size: 11px; color: #86868b; line-height: 1.55; max-height: 48px; overflow: hidden; }
.shot-actions { margin-top: 8px; display: flex; gap: 6px; }
.shot-actions button {
  flex: 1; padding: 7px 10px; font-size: 12px;
  border-radius: 8px; border: none; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.shot-actions .btn-gen {
  background: #7c4dff; color: #fff;
}
.shot-actions .btn-gen:hover { background: #1b7fd5; }
.shot-actions .btn-gen:disabled { background: #3a3a3c; cursor: wait; }
.shot-actions .btn-view {
  background: #2d2d2f; color: #d1d1d6;
}

.empty-msg {
  padding: 80px 20px; text-align: center;
  color: #86868b; font-size: 14px;
}

.loading { padding: 100px 20px; text-align: center; color: #86868b; }
.loading .spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #7c4dff;
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}

/* 放大弹窗 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10000; display: none;
  align-items: center; justify-content: center;
  padding: 40px;
}
.lightbox.active { display: flex; flex-direction: column; gap: 14px; }
.lb-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.9); color: #000;
  border: none; font-size: 20px; cursor: pointer;
}
.lb-body { max-width: 95vw; max-height: 85vh; }
.lb-body img { max-width: 95vw; max-height: 85vh; border-radius: 12px; }
.lb-info { color: #f5f5f7; font-size: 13px; max-width: 80vw; text-align: center; }

/* ============= 资产视图（assets 模式） ============= */

.asset-group-title {
  font-size: 14px; font-weight: 600; color: #f5f5f7;
  margin: 8px 0 12px;
  padding-left: 4px;
  border-left: 3px solid #7c4dff;
  padding: 2px 0 2px 10px;
  letter-spacing: 0.5px;
}

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

.asset-card {
  background: #1d1d1f; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
  display: flex; flex-direction: column;
  cursor: pointer; transition: all 0.2s;
}
.asset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 77, 255,0.4);
  box-shadow: 0 6px 24px rgba(124, 77, 255,0.12);
}

.asset-image-wrap {
  position: relative;
  aspect-ratio: 9/16; /* 资产以人物立绘为主，竖屏；场景 16:9 也能塞下，留信比 cover */
  background: #0d0d0f;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.asset-image-wrap.placeholder::before {
  content: '尚未生成'; color: #48484a; font-size: 12px;
}
.asset-image-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.asset-type-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.6);
  color: #f5f5f7; font-size: 11px;
  padding: 2px 8px; border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.asset-body {
  padding: 10px 14px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.asset-name { font-size: 13px; font-weight: 600; color: #f5f5f7; }
.asset-desc {
  font-size: 11px; color: #86868b; line-height: 1.5;
  max-height: 48px; overflow: hidden;
}

/* ============= 模式切换 pill ============= */

.mode-switch {
  display: inline-flex; gap: 4px;
  background: #0a0a0c; border-radius: 10px;
  padding: 3px;
  border: 1px solid #2c2c2e;
}
.mode-pill {
  background: transparent; color: #86868b;
  border: none; cursor: pointer;
  padding: 6px 14px; font-size: 12px;
  border-radius: 8px;
  font-family: inherit;
  transition: all 0.15s;
}
.mode-pill:hover:not(.active):not(.disabled) {
  color: #f5f5f7;
  background: rgba(255,255,255,0.04);
}
.mode-pill.active {
  background: #7c4dff; color: #fff; font-weight: 500;
}
.mode-pill.disabled {
  color: #48484a; cursor: not-allowed;
}
