/* ══════════════════════════════════════════════════════
   Image Ku · style.css  (v2 — Cloudflare 全栈版)
   ══════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg:           #0c0c0f;
  --bg-2:         #111115;
  --bg-3:         #18181e;
  --surface:      #1e1e26;
  --surface-2:    #25252f;
  --surface-3:    #2d2d38;
  --border:       rgba(255,255,255,.07);
  --border-2:     rgba(255,255,255,.13);
  --text:         #e8e8f0;
  --text-2:       #9898aa;
  --text-3:       #54546a;
  --accent:       #a78bfa;
  --accent-2:     #7c3aed;
  --accent-3:     #6d28d9;
  --accent-glow:  rgba(167,139,250,.22);
  --green:        #34d399;
  --danger:       #f87171;
  --danger-bg:    rgba(248,113,113,.1);
  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --t:            .2s cubic-bezier(.4,0,.2,1);
  --sidebar-w:    220px;
  --header-h:     60px;
  --batch-h:      52px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }
input, select { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ══════════════════════════════════════════════════════
   LOGIN OVERLAY
   ══════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(124,58,237,.15) 0%, var(--bg) 65%);
}
.login-overlay.hidden { display: none; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 40px;
  width: min(400px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
}
.login-brand .brand-icon {
  color: var(--accent);
  animation: pulse-glow 3s ease-in-out infinite;
}
.login-card h2 { font-size: 17px; color: var(--text-2); font-weight: 400; }
.login-field input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: var(--t);
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: var(--t);
  box-shadow: 0 4px 16px rgba(124,58,237,.35);
}
.login-submit:hover { opacity: .88; transform: translateY(-1px); }
.login-err { color: var(--danger); font-size: 13px; text-align: center; }
.login-err.hidden { display: none; }

/* ══════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(12,12,15,.88);
  backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1800px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; user-select: none; }
@keyframes pulse-glow {
  0%,100% { text-shadow: 0 0 6px var(--accent-glow); }
  50%      { text-shadow: 0 0 18px var(--accent), 0 0 36px var(--accent-glow); }
}
.brand-icon { color: var(--accent); font-size: 17px; animation: pulse-glow 3s ease-in-out infinite; }
.brand-name {
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 55%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search */
.search-box {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 38px;
  transition: var(--t);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box svg { color: var(--text-3); flex-shrink: 0; }
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }
.search-box input::placeholder { color: var(--text-3); }

/* Controls */
.header-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 0 10px;
  height: 36px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: var(--t);
}
.sort-select:hover { border-color: var(--border-2); }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t);
}
.icon-btn:hover { border-color: var(--border-2); color: var(--text); }
.icon-btn.active { background: var(--surface-2); color: var(--accent); border-color: var(--accent-glow); }

.upload-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--t);
  box-shadow: 0 3px 12px rgba(124,58,237,.3);
}
.upload-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 20px rgba(124,58,237,.45); }
.upload-btn.large { padding: 11px 26px; font-size: 14px; border-radius: var(--radius); margin-top: 16px; }

/* ══════════════════════════════════════════════════════
   BATCH BAR
   ══════════════════════════════════════════════════════ */
.batch-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 190;
  height: var(--batch-h);
  background: rgba(30,30,38,.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(167,139,250,.2);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}
.batch-bar.hidden { display: none; }

.batch-count { font-size: 13px; font-weight: 500; color: var(--accent); flex-shrink: 0; }
.batch-actions { display: flex; gap: 8px; flex: 1; }

.batch-btn {
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: var(--t);
}
.batch-btn:hover { background: var(--surface-3); }
.batch-btn.danger { color: var(--danger); border-color: rgba(248,113,113,.25); }
.batch-btn.danger:hover { background: var(--danger-bg); }
.batch-cancel { margin-left: auto; font-size: 13px; color: var(--text-3); background: none; border: none; }
.batch-cancel:hover { color: var(--text-2); }

/* ══════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.sidebar-section {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-util { margin-top: auto; border-bottom: none; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
  padding: 0 4px;
}
.section-add-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-3);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t);
  line-height: 1;
}
.section-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Nav items */
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  transition: var(--t);
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: rgba(167,139,250,.12); color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 99px;
}

/* Album items */
.album-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--t);
  position: relative;
}
.album-item:hover { background: var(--surface); color: var(--text); }
.album-item.active { background: rgba(167,139,250,.1); color: var(--accent); }
.album-item .album-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-item .album-count { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.album-delete-btn {
  position: absolute;
  right: 6px;
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
  padding: 0 3px;
  transition: var(--t);
}
.album-item:hover .album-delete-btn { opacity: 1; }
.album-delete-btn:hover { color: var(--danger); }

/* Tags cloud */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 4px; }
.tag-chip {
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: var(--t);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip.active { background: rgba(167,139,250,.15); border-color: var(--accent); color: var(--accent); }

.sidebar-loading { font-size: 12px; color: var(--text-3); padding: 4px; }

/* Util btn */
.util-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  transition: var(--t);
}
.util-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Gallery Main ── */
.gallery-main {
  flex: 1;
  min-width: 0;
  padding: 24px 24px 80px;
}

/* Count bar */
.count-bar {
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ══════════════════════════════════════════════════════
   GALLERY CARDS
   ══════════════════════════════════════════════════════ */

/* Masonry */
.gallery.masonry { columns: 5 200px; column-gap: 14px; }
.gallery.masonry .card { break-inside: avoid; margin-bottom: 14px; }

/* List view */
.gallery.list-view { display: flex; flex-direction: column; gap: 8px; }
.gallery.list-view .card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--t);
}
.gallery.list-view .card:hover { border-color: var(--border-2); background: var(--surface-2); }
.gallery.list-view .card .thumb { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.gallery.list-view .card .card-body { display: none; }
.gallery.list-view .card .list-info { flex: 1; min-width: 0; }
.gallery.list-view .card .list-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery.list-view .card .list-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.gallery.list-view .card .list-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.gallery.list-view .card .list-tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--accent); border: 1px solid var(--border); }

/* Masonry card */
.gallery.masonry .card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--t);
  position: relative;
}
.gallery.masonry .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 0 1px rgba(167,139,250,.2);
  border-color: rgba(167,139,250,.25);
  z-index: 2;
}
.gallery.masonry .card img.thumb {
  width: 100%;
  display: block;
  object-fit: cover;
  border-radius: 0;
}
.gallery.masonry .card .card-body {
  padding: 9px 11px 11px;
}
.gallery.masonry .card .card-name {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.gallery.masonry .card .card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.card-tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--border); color: var(--accent); }

/* Hover overlay */
.gallery.masonry .card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8,8,14,.65) 0%, transparent 45%);
  opacity: 0;
  transition: var(--t);
  pointer-events: none;
}
.gallery.masonry .card:hover::after { opacity: 1; }

/* Batch checkbox */
.card-checkbox {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,.6);
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--t);
  pointer-events: none;
}
.gallery.masonry .card:hover .card-checkbox,
.card.selected .card-checkbox { opacity: 1; }
.card.selected .card-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}
.card.selected .card-checkbox::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}
.card.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

.gallery.list-view .card-checkbox {
  position: relative;
  top: auto;
  left: auto;
  opacity: 1;
  flex-shrink: 0;
}

/* ── Empty ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 100px 20px;
  text-align: center;
  gap: 10px;
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 52px; filter: grayscale(.4); }
.empty-state h2 { font-size: 20px; font-weight: 600; margin-top: 8px; }
.empty-state p { font-size: 14px; color: var(--text-2); }

/* Load more */
.load-more-wrap { display: flex; justify-content: center; padding: 32px 0 0; }
.load-more-btn {
  padding: 10px 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: var(--t);
}
.load-more-btn:hover { background: var(--surface-2); border-color: var(--accent); }

/* ══════════════════════════════════════════════════════
   DROP OVERLAY
   ══════════════════════════════════════════════════════ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(8,8,14,.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-overlay.hidden { display: none; }
.drop-box {
  border: 2px dashed var(--accent);
  border-radius: 24px;
  padding: 60px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--accent);
  animation: scale-in .2s ease;
}
.drop-box p { font-size: 18px; font-weight: 500; }
@keyframes scale-in { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ══════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(6,6,10,.97);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}
.lightbox.hidden { display: none; }

.lb-close, .lb-nav {
  position: fixed;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t);
  backdrop-filter: blur(8px);
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.13); }
.lb-close { top: 18px; right: 18px; width: 42px; height: 42px; z-index: 10; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; z-index: 10; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-nav:disabled, .lb-nav[style*="opacity:.3"] { pointer-events: none; }

.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 80px;
  min-height: 0;
  overflow: hidden;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.8);
  animation: lb-in .24s ease;
}
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }

/* Panel */
.lb-panel {
  flex-shrink: 0;
  background: rgba(18,18,24,.95);
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Meta row */
.lb-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.lb-meta-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-filename { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.lb-fileinfo { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.lb-meta-right { display: flex; gap: 8px; flex-shrink: 0; }

.lb-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: var(--t);
}
.lb-action-btn:hover { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.lb-action-btn.danger { color: var(--danger); }
.lb-action-btn.danger:hover { background: var(--danger-bg); border-color: rgba(248,113,113,.3); }
.lb-action-btn.share-link { color: var(--text-2); }

/* Tags */
.lb-tags-row { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
}
.lb-tag-rm { cursor: pointer; color: var(--text-3); font-size: 14px; line-height: 1; transition: color .15s; }
.lb-tag-rm:hover { color: var(--danger); }

.lb-tag-add input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 7px 12px;
  width: 260px;
  outline: none;
  transition: var(--t);
}
.lb-tag-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.lb-tag-add input::placeholder { color: var(--text-3); }

/* Embed section */
.embed-section { display: flex; flex-direction: column; gap: 8px; }
.embed-tabs { display: flex; gap: 4px; }
.embed-tab {
  padding: 4px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-3);
  font-size: 12px;
  transition: var(--t);
}
.embed-tab:hover { color: var(--text-2); border-color: var(--border-2); }
.embed-tab.active { background: var(--surface-2); color: var(--accent); border-color: rgba(167,139,250,.3); }

.embed-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.embed-code {
  flex: 1;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: var(--green);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.copy-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  transition: var(--t);
  white-space: nowrap;
}
.copy-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-btn.copied { background: rgba(52,211,153,.15); border-color: var(--green); color: var(--green); }

/* Album select in lightbox */
.lb-album-row { display: flex; }
.album-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--t);
  min-width: 200px;
}
.album-select:hover { border-color: var(--border-2); }
.album-select:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  width: min(420px, 90vw);
  overflow: hidden;
  animation: scale-in .2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: none;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: var(--t);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.modal-input, .modal-select {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: var(--t);
}
.modal-input:focus, .modal-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-input::placeholder { color: var(--text-3); }
.modal-hint { font-size: 12.5px; color: var(--text-3); }

.modal-btn {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--t);
}
.modal-btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent-3)); color: #fff; box-shadow: 0 3px 12px rgba(124,58,237,.3); }
.modal-btn.primary:hover { opacity: .88; }
.modal-btn.secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.modal-btn.secondary:hover { background: var(--surface-3); }

/* Migration */
.migrate-progress { display: flex; flex-direction: column; gap: 8px; }
.migrate-progress.hidden { display: none; }
.progress-bar { width: 100%; height: 6px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; width: 0%; transition: width .3s ease; }
.progress-text { font-size: 12.5px; color: var(--text-3); }
#migrate-info { font-size: 14px; color: var(--text-2); line-height: 1.7; }

/* ══════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 7px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 99px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
  animation: toast-in .22s ease forwards;
  pointer-events: auto;
  max-width: 360px;
  text-align: center;
}
.toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .gallery.masonry { columns: 3 160px; }
}
@media (max-width: 600px) {
  .gallery.masonry { columns: 2 140px; }
  .lb-stage { padding: 16px 56px; }
  .lb-panel { padding: 12px 16px; }
  .lb-tag-add input { width: 100%; }
  .lb-filename { max-width: 180px; }
  .header-inner { gap: 8px; padding: 0 12px; }
  .gallery-main { padding: 14px 14px 60px; }
  .sort-select { display: none; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .gallery.masonry { columns: 2 120px; }
}
