:root {
  --bg: #fbf7f1;
  --panel: rgba(255,255,255,.92);
  --muted: rgba(17,24,39,.62);
  --text: #0b1220;
  --accent: #1d4ed8;
  --border: rgba(17,24,39,.10);
  --shadow: 0 14px 40px rgba(17,24,39,.09);
  --radius: 16px;
  --radius2: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --danger: #dc2626;
  --success: #16a34a;
  --row-hover: rgba(29,78,216,.03);
  --row-selected: rgba(29,78,216,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}

/* ── Top Bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.topbar h1 a { text-decoration: none; color: inherit; }

.page-label {
  font-weight: 500;
  color: var(--muted);
  margin-left: 8px;
  font-size: .9rem;
}

.topnav { display: flex; align-items: center; gap: 16px; font-size: .85rem; }
.topnav a { text-decoration: none; color: var(--muted); font-weight: 500; transition: color .2s; }
.topnav a:hover { color: var(--accent); }
.topnav a.nav-active { color: var(--accent); font-weight: 700; }

.nav-icon {
  width: 16px; height: 16px;
  vertical-align: middle;
  margin-right: 3px;
  image-rendering: pixelated;
}

.auth-chip {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  background: rgba(29,78,216,.1);
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.auth-chip:hover { color: var(--accent); opacity: .9; }

/* ── Container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Search Bar ── */
.search-bar {
  margin-bottom: 0;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap input[type="search"] {
  width: 100%;
  padding: 11px 36px 11px 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .9rem;
  font-family: var(--sans);
  background: var(--bg);
  outline: none;
  transition: border-color .2s;
}

.search-input-wrap input[type="search"]:focus {
  border-color: var(--accent);
}

.search-input-wrap input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  line-height: 1;
}

.search-clear:hover { color: var(--text); }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-group label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.filter-group select,
.filter-group input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
  font-family: var(--sans);
  background: var(--bg);
  min-width: 220px;
  cursor: pointer;
  outline: none;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus { border-color: var(--accent); }

.collection-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.collection-input-wrap input {
  padding-right: 28px !important;
}

.collection-clear {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  line-height: 1;
}

.collection-clear:hover { color: var(--text); }

.toolbar-sep {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

.select-all-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.select-all-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toolbar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-size: .82rem;
  font-weight: 600;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
}

/* 4 complementary tints for toolbar chips (harmonious with --bg #fbf7f1) */
.stat-chip.count {
  background: #f2ede8;
  color: #4a4038;
}

.stat-chip.selected-size {
  background: #e8eefa;
  color: #2d4a7c;
}

.stat-chip .num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .85rem;
}

.stat-chip.selected-size .num {
  color: var(--accent);
}

/* ── Toolbar Actions ── */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-selection {
  background: #fde8ec;
  color: #8b5a5f;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, background .2s;
  font-family: var(--sans);
  white-space: nowrap;
}

.btn-selection:hover:not(:disabled) { background: #f5d4da; opacity: 1; }
.btn-selection:disabled { opacity: .4; cursor: not-allowed; }

.stat-chip.selection-count {
  background: #e8f4ed;
  color: #3d5c4a;
  cursor: pointer;
  transition: background .2s;
}

.stat-chip.selection-count:hover {
  background: #d4ecd9;
}

.stat-chip.selection-count .num {
  color: #2d5c3d;
}

/* ── Table ── */
.cid-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.cid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.cid-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: rgba(17,24,39,.02);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.cid-table th.col-check,
.cid-table td.col-check {
  width: 36px;
  text-align: center;
  padding-left: 12px;
  padding-right: 4px;
}

.cid-table th.col-title  { width: 22%; }
.cid-table th.col-cid    { width: 38%; }
.cid-table th.col-size   { width: 10%; text-align: right; }
.cid-table th.col-actions { width: 14%; min-width: 100px; text-align: right; }

.cid-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cid-table td.col-size { text-align: right; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.cid-table td.col-actions { text-align: right; white-space: nowrap; }

.cid-table tbody tr {
  transition: background .15s;
}

.cid-table tbody tr:hover {
  background: var(--row-hover);
}

.cid-table tbody tr.row-selected {
  background: var(--row-selected);
}

.cid-table tbody tr.row-root-cid {
  border-left: 4px solid #eab308;
  background: rgba(234, 179, 8, .06);
}

.cid-table tbody tr.row-root-cid:hover {
  background: rgba(234, 179, 8, .10);
}

.root-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 6px;
  border: 1px solid rgba(234, 179, 8, .3);
  vertical-align: middle;
  letter-spacing: .02em;
}

.size-pending {
  color: var(--muted);
  font-style: italic;
  font-size: .7rem;
}

.image-cid-hint {
  color: #059669;
  cursor: help;
  font-size: .7rem;
  margin-left: 2px;
}

.cid-table tbody tr.row-master {
  border-left: 4px solid var(--accent);
  background: rgba(29,78,216,.04);
}

.cid-table tbody tr.row-layer {
  border-left: 4px solid rgba(29,78,216,.4);
  background: rgba(29,78,216,.02);
}

.cid-table tbody tr.row-layer .cell-title {
  padding-left: 20px; /* visuele indent t.o.v. Master */
}

.master-badge {
  display: inline-block;
  background: rgba(29,78,216,.12);
  color: var(--accent);
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: .02em;
}

.expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: .7rem;
  cursor: pointer;
  vertical-align: middle;
}
.expand-btn:hover {
  background: rgba(29,78,216,.1);
  border-color: var(--accent);
}
.expand-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.btn-select-all-files {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
}
.btn-select-all-files:hover {
  background: rgba(29,78,216,.08);
  border-color: var(--accent);
}

.cid-table tbody tr.row-child .cell-title {
  padding-left: 24px;
}

.cid-table tbody tr.row-artist-header td {
  padding: 8px 12px;
  background: rgba(29,78,216,.06);
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: .8rem;
  color: var(--accent);
}
.cid-table tbody tr.row-artist-header .artist-header {
  letter-spacing: .02em;
}

.blueprint-badge {
  display: inline-block;
  background: rgba(16,185,129,.12);
  color: #059669;
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: .02em;
}

.bundle-badge {
  display: inline-block;
  background: rgba(139,92,246,.12);
  color: #6d28d9;
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: .02em;
}

.makersplace-badge {
  display: inline-block;
  background: rgba(234,88,12,.12);
  color: #c2410c;
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: .02em;
}

.cid-table tbody tr.row-blueprint {
  border-left: 4px solid rgba(16,185,129,.5);
  background: rgba(16,185,129,.02);
}

.cid-table tbody tr:last-child td {
  border-bottom: none;
}

/* Row checkbox */
.row-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Title cell */
.cell-title {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  line-height: 1.3;
}

.cell-title .cell-collection {
  font-weight: 700;
  color: var(--accent);
}

.cell-title .sub {
  font-weight: 400;
  font-size: .72rem;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}

/* CID cell */
.cell-cid {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: .68rem;
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 600;
}

.copy-btn:hover { background: rgba(29,78,216,.08); }

/* Actions */
.act-link {
  font-size: .72rem;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .15s;
  font-weight: 500;
}

.act-link:hover { color: var(--accent); background: rgba(29,78,216,.05); }
.act-muted { color: var(--muted); font-size: .85rem; }

/* CID Preview */
.col-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cid-extern {
  font-size: .8rem;
}

.cid-viewer-toggle {
  font-size: .72rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 500;
  transition: all .15s;
}

.cid-viewer-toggle:hover {
  color: #fff;
  background: var(--accent);
}

/* CID Viewer Modal */
.cid-viewer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(17,24,39,.4);
  backdrop-filter: blur(4px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.cid-viewer-overlay.cid-viewer-open {
  display: flex;
}

.cid-viewer-overlay > * {
  margin: auto;
}

.cid-viewer-overlay[role="dialog"] {
  flex-direction: column;
}

.cid-viewer-overlay .cid-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--panel);
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  box-shadow: var(--shadow);
  transition: all .15s;
}

.cid-viewer-overlay .cid-viewer-close:hover {
  color: var(--text);
  background: #fff;
}

.cid-viewer-overlay .cid-viewer-title {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  max-width: 90%;
  word-break: break-word;
}

.cid-viewer-content {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 24px;
}

.cid-viewer-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.cid-viewer-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.cid-viewer-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cid-viewer-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  min-width: 80px;
}

.cid-viewer-cid {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cid-viewer-copy {
  font-size: .72rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--sans);
  transition: all .15s;
}

.cid-viewer-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.cid-viewer-extern {
  font-size: .72rem;
  color: var(--accent);
  text-decoration: none;
}

.cid-viewer-extern:hover {
  text-decoration: underline;
}

.cid-viewer-panel {
  margin-top: 8px;
}

.cid-viewer-panel .cid-preview-panel {
  margin: 0;
}

.cid-viewer-panel video,
.cid-viewer-panel audio {
  max-width: 100%;
}

.cid-preview-panel {
  max-width: 100%;
}

.cid-preview-content {
  margin-top: 8px;
}

.cid-preview-panel .cid-extern-btn {
  display: inline-block;
  font-size: .72rem;
  color: var(--accent);
  margin-bottom: 8px;
  text-decoration: none;
}

.cid-preview-panel .cid-extern-btn:hover {
  text-decoration: underline;
}

.cid-loading, .cid-error, .cid-external-hint {
  font-size: .82rem;
  color: var(--muted);
  margin: 8px 0;
}

.cid-error { color: #b91c1c; }

.cid-json-preview {
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding: 12px;
  background: rgba(17,24,39,.04);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.pin-btn {
  font-size: .72rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity .15s;
  font-family: var(--sans);
}

.pin-btn:hover { opacity: .85; }

/* ── Buttons (modal) ── */
.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  font-family: var(--sans);
}

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-outline { background: transparent; color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-size: .85rem;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: var(--panel);
  cursor: pointer;
  font-family: var(--sans);
  font-size: .82rem;
  transition: all .2s;
}

.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { color: var(--muted); padding: 0 8px; }
.pagination .btn-load-more { margin-left: 8px; }

/* Infinite scroll sentinel (below gallery grid) */
.library-scroll-sentinel {
  min-height: 1px;
  height: 1px;
  pointer-events: none;
  margin-top: 16px;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}
.library-scroll-sentinel.loading { min-height: 24px; height: auto; padding: 8px 0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden { display: none !important; }

.modal {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 500px;
  width: 92%;
  box-shadow: var(--shadow);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 1.05rem; }

.modal-close {
  border: none; background: transparent;
  font-size: 1.4rem; cursor: pointer;
  color: var(--muted); line-height: 1; padding: 4px;
}

.pin-cid-label { font-size: .82rem; color: var(--muted); margin: 0 0 4px; }

.pin-cid-value {
  font-family: var(--mono); font-size: .78rem;
  background: rgba(17,24,39,.04);
  padding: 8px 10px; border-radius: 8px;
  display: block; word-break: break-all;
  margin-bottom: 16px;
}

.pin-auth-msg { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }

.pool-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.pool-option {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius2);
  cursor: pointer;
  transition: border-color .2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pool-option:hover { border-color: var(--accent); }
.pool-option.selected { border-color: var(--accent); background: rgba(29,78,216,.04); }
.pool-option .pool-name { font-weight: 600; font-size: .9rem; }
.pool-option .pool-info { font-size: .78rem; color: var(--muted); }

.pin-actions { margin-top: 12px; }
.pin-feedback { margin-top: 12px; font-size: .85rem; min-height: 20px; }
.pin-feedback.success { color: var(--success); }
.pin-feedback.error { color: var(--danger); }

.loading { color: var(--muted); font-size: .9rem; font-style: italic; padding: 20px 0; text-align: center; }
.empty { color: var(--muted); font-size: .9rem; font-style: italic; text-align: center; padding: 40px 0; }
.label { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

/* ── Gallery View (uniform with curator) ── */
.nft-gallery-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
}

/* Grid: same as curator — 200×200 cells */
.nft-gallery-wrap .grid.nft-gallery-grid,
.nft-gallery-wrap .nft-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 200px));
  gap: 16px;
  margin-bottom: 20px;
  justify-content: start;
}

/* Card: same as curator — 200×200, square, thumb + meta */
.nft-gallery-wrap .card.nft-card,
.nft-gallery-wrap .nft-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 200px;
  height: 200px;
  aspect-ratio: 1;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(17,24,39,.05);
  padding: 0;
  min-height: unset;
  align-items: stretch;
  gap: 0;
}

.nft-gallery-wrap .card.nft-card::after,
.nft-gallery-wrap .nft-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--radius2) - 1px);
  border: 1px solid rgba(249,115,22,.40);
  pointer-events: none;
}

.nft-gallery-wrap .card.nft-card:hover,
.nft-gallery-wrap .nft-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(29,78,216,.12);
  transform: translateY(-2px);
}

.nft-gallery-wrap .card.nft-card.card-selected,
.nft-gallery-wrap .nft-card.card-selected {
  border-color: var(--accent);
  background: rgba(29,78,216,.05);
  box-shadow: 0 0 0 2px rgba(29,78,216,.2), 0 4px 12px rgba(29,78,216,.12);
}

/* Thumb area: same as curator — flex 1, square */
.nft-gallery-wrap .nft-card .thumb.nft-card-image,
.nft-gallery-wrap .nft-card .nft-card-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: 1;
  border-radius: 0;
  border: none;
  background: linear-gradient(135deg, #f0f0f0 0%, #f9f9f9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nft-gallery-wrap .nft-card .thumb.nft-card-image img,
.nft-gallery-wrap .nft-card .nft-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1;
}

.nft-gallery-wrap .nft-card .nft-card-image .no-image {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Meta block: same as curator — flex 0 0 auto */
.nft-gallery-wrap .nft-card .meta.nft-card-content,
.nft-gallery-wrap .nft-card .nft-card-content {
  flex: 0 0 auto;
  padding: 6px 8px;
  gap: 2px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.nft-gallery-wrap .nft-card .name.nft-card-title,
.nft-gallery-wrap .nft-card .nft-card-title {
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  font-weight: 600;
  color: var(--text);
}

.nft-gallery-wrap .nft-card .artist.nft-card-artist,
.nft-gallery-wrap .nft-card .nft-card-collection {
  font-size: 0.75rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nft-gallery-wrap .nft-card .nft-card-storage,
.nft-gallery-wrap .nft-card .nft-card-blockchain {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.nft-gallery-wrap .nft-card .nft-card-cids {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cid-icon {
  font-size: 0.9rem;
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.cid-icon:hover {
  opacity: 1;
}

/* Card checkbox (library-only): same position, curator-style card */
.nft-gallery-wrap .nft-card-checkbox {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  background: white;
  border: 2px solid var(--border);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(17,24,39,.08);
}

.nft-gallery-wrap .nft-card-checkbox:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(29,78,216,.15);
}

.nft-gallery-wrap .nft-card-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.nft-gallery-wrap .nft-card-checkbox:checked::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Actions Bar (Bottom) ── */
.gallery-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  gap: 12px;
}

.gallery-actions-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.gallery-actions-right {
  display: flex;
  gap: 12px;
}

.archive-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.archive-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  min-width: 100px;
}

/* ── Responsive Gallery (match curator) ── */
@media (max-width: 768px) {
  .nft-gallery-wrap .grid.nft-gallery-grid,
  .nft-gallery-wrap .nft-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 160px));
    gap: 12px;
  }
  
  .nft-gallery-wrap .card.nft-card,
  .nft-gallery-wrap .nft-card {
    width: 160px;
    height: 160px;
  }
  
  .gallery-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .gallery-actions-left {
    justify-content: space-between;
  }
  
  .gallery-actions-right {
    width: 100%;
  }
  
  .gallery-actions-right .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .nft-gallery-wrap .grid.nft-gallery-grid,
  .nft-gallery-wrap .nft-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .nft-gallery-wrap .card.nft-card,
  .nft-gallery-wrap .nft-card {
    width: 100%;
    height: auto;
    min-height: 180px;
    aspect-ratio: 1;
  }
  
  .nft-gallery-wrap .nft-card .nft-card-title {
    font-size: 0.8rem;
  }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-sep { display: none; }
  .toolbar-stats { margin-left: 0; justify-content: flex-start; }
  .container { padding: 12px; }
  .cid-table { font-size: .75rem; }
  .cid-table th, .cid-table td { padding: 6px 8px; }
}
