/* ================================================
   Darkroom Studio — Darkroom Theme CSS
   ================================================ */

@import url('https://fonts.googleapis.cn/css2?family=Playfair+Display:wght@400;600;700;900&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg: #1a1a22;
  --bg-card: #23232f;
  --bg-elevated: #2a2a38;
  --fg: #ede9e0;
  --fg-muted: #8a8698;
  --fg-dim: #5c5868;
  --primary: #d4a04a;
  --primary-hover: #e0b05e;
  --primary-dim: rgba(212, 160, 74, 0.15);
  --primary-border: rgba(212, 160, 74, 0.25);
  --danger: #e05252;
  --danger-dim: rgba(224, 82, 82, 0.1);
  --danger-border: rgba(224, 82, 82, 0.2);
  --success: #4aba7a;
  --success-dim: rgba(74, 186, 122, 0.1);
  --success-border: rgba(74, 186, 122, 0.2);
  --border: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.18);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', 'Noto Serif SC', Georgia, serif;
  --font-mono: 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --transition: 200ms ease;
}

/* ---------- Light Theme ---------- */
:root.light {
  --bg: #f5f3ef;
  --bg-card: #ffffff;
  --bg-elevated: #eae8e3;
  --fg: #1a1a22;
  --fg-muted: #6b6880;
  --fg-dim: #9995a8;
  --primary: #b8862e;
  --primary-hover: #a07428;
  --primary-dim: rgba(184, 134, 46, 0.12);
  --primary-border: rgba(184, 134, 46, 0.25);
  --danger: #d04040;
  --danger-dim: rgba(208, 64, 64, 0.08);
  --danger-border: rgba(208, 64, 64, 0.18);
  --success: #2d9a5a;
  --success-dim: rgba(45, 154, 90, 0.08);
  --success-border: rgba(45, 154, 90, 0.18);
  --border: rgba(0, 0, 0, 0.08);
  --border-input: rgba(0, 0, 0, 0.12);
  --border-hover: rgba(0, 0, 0, 0.18);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

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

img { max-width: 100%; display: block; }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

::selection { background: var(--primary-dim); color: var(--primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fg-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); }

/* ---------- Noise Overlay ---------- */
.noise-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 50;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Ambient Background ---------- */
.ambient-bg {
  position: fixed; inset: 0;
  pointer-events: none; overflow: hidden; z-index: 0;
}
.glow {
  position: absolute; border-radius: 50%; filter: blur(120px);
}
.glow-1 {
  width: 600px; height: 600px;
  top: -25%; right: -25%;
  background: rgba(212, 160, 74, 0.06);
  animation: amber-pulse 4s ease-in-out infinite;
}
.glow-2 {
  width: 500px; height: 500px;
  bottom: -25%; left: -25%;
  background: rgba(100, 80, 160, 0.04);
}

@keyframes amber-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

/* ---------- Container ---------- */
.container {
  position: relative; z-index: 10;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
@media (min-width: 640px) { .container { padding: 2rem 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 2rem 2rem; } }

/* ---------- Header ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 3rem;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  position: relative;
}
.logo-icon::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: calc(var(--radius) + 4px);
  background: rgba(212, 160, 74, 0.05);
  filter: blur(8px);
  z-index: -1;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.logo-sub {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.header-right { display: flex; align-items: center; gap: 0.25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  background: transparent;
  color: var(--fg);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.btn-ghost { border: none; background: transparent; color: var(--fg-muted); }
.btn-ghost:hover { color: var(--fg); background: rgba(255,255,255,0.05); }

/* Power badge */
#user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.power-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  border-radius: 6px;
  height: 30px;
  box-sizing: border-box;
  line-height: 1;
}
.power-badge svg { opacity: 0.8; flex-shrink: 0; }

/* Check-in button */
#check-in-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  height: 30px;
  box-sizing: border-box;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid var(--primary-border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#check-in-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#check-in-btn.checked-in {
  background: var(--primary-dim);
  color: var(--fg-muted);
  border-color: var(--primary-border);
  cursor: default;
}

.btn-primary {
  background: var(--primary); color: var(--bg);
  border-color: var(--primary);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border-input);
}
.btn-outline:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.03); }
.btn-full { width: 100%; }
.text-danger { color: var(--danger) !important; }
.hidden { display: none !important; }

/* ---------- Form Elements ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem; font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--fg);
}
.flex-label { display: flex !important; align-items: center; gap: 0.4rem; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.875rem;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary-border); }
input::placeholder, textarea::placeholder { color: var(--fg-dim); }
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
select {
  appearance: none;
  background-color: var(--bg-elevated);
  color: var(--fg);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8698' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
select option {
  background-color: var(--bg-card);
  color: var(--fg);
}
.form-group select {
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  box-sizing: border-box;
}
.hint-text { font-size: 0.75rem; color: var(--fg-muted); display: block; padding-top: 2px; }
.amber-hint { color: var(--primary) !important; opacity: 0.7; }
.form-error {
  font-size: 0.8rem; color: var(--danger);
  padding: 0.5rem 0.75rem;
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.static-field {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.input-with-btn { display: flex; gap: 0.5rem; align-items: center; }
.input-with-btn input { flex: 1; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }

/* ---------- Switch Toggle ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-input);
  border-radius: 22px;
  cursor: pointer;
  transition: all var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; bottom: 2px;
  background: var(--fg-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.switch input:checked + .slider {
  background: var(--primary-dim);
  border-color: var(--primary-border);
}
.switch input:checked + .slider::before {
  transform: translateX(18px);
  background: var(--primary);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
}
.badge-primary { background: var(--primary-dim); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-amber { background: var(--primary-dim); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-secondary { background: rgba(255,255,255,0.05); color: var(--fg-muted); border: 1px solid var(--border); }

kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ---------- Auth Card ---------- */
.auth-card {
  max-width: 400px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.auth-tab:hover:not(.active) { color: var(--fg); }

/* ---------- Generation Card ---------- */
.gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}
@media (min-width: 640px) { .gen-card { padding: 2rem; } }

.settings-row {
  display: flex; flex-direction: column; gap: 0.75rem;
}
@media (min-width: 640px) {
  .settings-row { flex-direction: row; align-items: flex-end; gap: 0.75rem; }
  .settings-row .form-group { margin-bottom: 0; flex: 1; display: flex; flex-direction: column; position: relative; }
  .settings-row .form-group label { margin-bottom: 0.25rem; font-size: 0.75rem; display: block; height: 1.25rem; line-height: 1.25rem; }
  .settings-row .form-group select { height: 40px; min-height: 40px; max-height: 40px; box-sizing: border-box; }
  .settings-row .hint-text { position: absolute; bottom: -18px; left: 0; white-space: nowrap; }
  .settings-row .gen-btn { height: 40px; flex-shrink: 0; }
}

.gen-btn {
  min-width: 130px; height: 40px;
  align-self: flex-end;
  flex-shrink: 0;
}

.warning-banner {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  font-size: 0.8rem;
  color: var(--primary);
  margin-top: 1rem;
}

/* ---------- Section Header ---------- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 600;
  color: var(--fg);
  display: flex; align-items: center; gap: 0.75rem;
}

/* ---------- Power Cost Badge ---------- */
.power-cost {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  vertical-align: middle;
  color: var(--text-muted);
}

/* ---------- Task Tabs ---------- */
.task-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.task-tab {
  flex: 1; padding: 0.75rem 1rem; background: none; border: none;
  color: var(--text-muted); font-size: 0.9rem; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.task-tab:hover { color: var(--text-secondary); }
.task-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.task-tab .badge { font-size: 0.65rem; }

.spinner-sm {
  display: none; width: 12px; height: 12px;
  border: 2px solid var(--primary-dim); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.spinner-sm.visible { display: inline-block; }

.task-panel { min-height: 60px; }
.empty-hint {
  text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-size: 0.85rem;
}

/* ---------- Task List ---------- */
.task-list { display: flex; flex-direction: column; gap: 0.75rem; }
.task-card {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.task-card.generating {
  border-color: var(--primary-border);
  background: var(--primary-dim);
}
.task-card.failed {
  border-color: var(--danger-border);
  background: var(--danger-dim);
}
.task-shimmer {
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-info p { font-size: 0.85rem; line-height: 1.5; }
.task-info p.line-clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-info p.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.task-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.task-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.task-actions .btn { font-size: 0.75rem; padding: 0.2rem 0.5rem; }

.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--primary-dim);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Gallery Grid ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
@media (max-width: 768px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }

.gallery-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s ease, transform 0.2s ease;
}
.gallery-card:hover { border-color: var(--primary-border); transform: scale(1.03); }

.gallery-img-wrap {
  aspect-ratio: 1; overflow: hidden; position: relative;
}
.gallery-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery-card:hover .gallery-img-wrap img { transform: scale(1.05); }

.gallery-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex; align-items: center; justify-content: center;
}
.gallery-card:hover .gallery-overlay { opacity: 1; }
.gallery-overlay .zoom-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

/* Reference Image Upload */
.ref-image-group { margin-bottom: 0; }
.ref-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-upload-area:hover, .ref-upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.05);
}
.ref-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.ref-preview {
  position: relative;
  display: inline-block;
  overflow: visible;
}
.ref-preview img {
  max-height: 120px;
  max-width: 100%;
  border-radius: 6px;
  object-fit: contain;
}
.ref-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--bg-primary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.ref-remove-btn:hover { transform: scale(1.15); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 90vw; max-height: 70vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 40px; height: 40px;
  border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 1.25rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1rem 1.5rem 1.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.lightbox-actions {
  display: flex; gap: 0.5rem; flex-shrink: 0;
}
.lightbox-info {
  color: rgba(255,255,255,0.85); font-size: 0.85rem;
  max-width: 80vw; text-align: center;
  line-height: 1.5; word-break: break-word;
}
.lightbox-action-btn {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15); color: #fff;
  border: none; cursor: pointer; font-size: 0.8rem;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; gap: 0.3rem;
  transition: background 0.2s;
}
.lightbox-action-btn:hover { background: rgba(255,255,255,0.3); }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; margin-top: 1rem;
}
.page-btn {
  min-width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--fg);
  cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--fg-muted); font-size: 0.8rem; }
.gallery-action-btn.danger:hover { background: rgba(224, 82, 82, 0.5); }

.gallery-info {
  padding: 0.75rem;
}
.gallery-info p {
  font-size: 0.75rem;
  color: var(--fg);
  opacity: 0.8;
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gallery-info .gallery-tags {
  display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  margin-top: 4rem;
  padding-bottom: 2rem;
}
.empty-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: var(--fg-dim);
}
.empty-state p { font-size: 0.85rem; color: var(--fg-dim); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  width: 100%; max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  animation: fade-up 0.3s ease-out;
}
.modal-sm { max-width: 360px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-header h3 {
  font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.5rem;
}
.modal-desc {
  font-size: 0.8rem; color: var(--fg-muted);
  padding: 0.25rem 1.5rem 0;
}
.modal-body { padding: 1.25rem 1.5rem 1.5rem; }
.modal-actions { margin-top: 1rem; }

.config-ok {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--success-dim);
  border: 1px solid var(--success-border);
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--success);
}
.config-ok .btn { margin-left: auto; }

/* ---------- User Info ---------- */
.user-info-block {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
.user-info-block svg { color: var(--primary); flex-shrink: 0; }
.user-name { font-weight: 600; font-size: 0.95rem; }
.user-email { font-size: 0.8rem; color: var(--fg-muted); font-family: var(--font-mono); }

/* ---------- Footer ---------- */
.footer { margin-top: 4rem; padding-bottom: 2rem; text-align: center; }
.divider {
  border: none; border-top: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.footer p { font-size: 0.75rem; color: var(--fg-dim); }
.footer-wechat { font-size: 0.7rem; color: var(--fg-muted); margin-top: 2px; }

/* ---------- Animations ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.6s ease-out forwards; }
.animate-fade-up-delay-1 { animation: fade-up 0.6s ease-out 0.1s forwards; opacity: 0; }
.animate-fade-up-delay-2 { animation: fade-up 0.6s ease-out 0.2s forwards; opacity: 0; }
.animate-fade-up-delay-3 { animation: fade-up 0.6s ease-out 0.3s forwards; opacity: 0; }

/* ---------- Responsive helpers ---------- */
@media (max-width: 639px) {
  .sm\:inline { display: none !important; }
}
@media (min-width: 640px) {
  .sm\:inline { display: inline !important; }
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #f5f0e8;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  max-width: 360px;
  word-break: break-word;
}
.toast.success { background: #2d6a4f; border: 1px solid #40916c; }
.toast.error { background: #6a2d2d; border: 1px solid #914040; }
.toast.warning { background: #6a5a2d; border: 1px solid #917a40; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(40px); } }

