#gallery-modal .modal-box {
  width: 860px; max-width: 95vw; max-height: 85vh;
  display: flex; flex-direction: column;
}

#gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  overflow-y: auto; flex: 1;
  padding-top: 4px;
}

#gallery-grid::-webkit-scrollbar { width: 6px; }
#gallery-grid::-webkit-scrollbar-track { background: transparent; }
#gallery-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.gallery-item {
  border-radius: var(--radius); overflow: hidden;
  border: 2px solid transparent; cursor: pointer;
  background: var(--surface2);
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
}
.gallery-item:hover { border-color: var(--accent); transform: translateY(-2px); }

.gallery-thumb {
  width: 100%; aspect-ratio: 16/10;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb-placeholder {
  color: var(--text2); font-size: 11px;
}

.gallery-info { padding: 8px; }
.gallery-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-meta { font-size: 11px; color: var(--text2); margin-top: 2px; }

.gallery-del {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1;
  display: none; align-items: center; justify-content: center;
}
.gallery-item:hover .gallery-del { display: flex; }
.gallery-del:hover { background: var(--danger); }

.gallery-empty {
  grid-column: 1/-1; text-align: center; padding: 48px;
  color: var(--text2);
}
.gallery-empty p { margin-bottom: 8px; }
