body {
  padding: max(16px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
}

/* ── Sticky header ── */
.header-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(17,26,43,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#countTag { font-size: .75rem; color: var(--text-muted); }

/* ── Gallery grid ── */
#gallery-grid {
  display: grid;
  gap: 20px;
  /* max. 2 Spalten auf Desktop, 1 auf Mobilgeräten – weniger „zusammengequetscht" */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}

#empty {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.empty-inner      { text-align: center; color: var(--text-muted); }
.empty-inner svg  { margin-bottom: 12px; opacity: .3; }
.empty-inner p    { font-size: .82rem; }

/* Thumbnails fill the card */
.card canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  background: #0d1525;
}
.card {
  transition: transform .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}
.card:active { transform: scale(0.98); }

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 10, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}
#lightbox.open { display: flex; }

#lightbox-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

#lightbox canvas {
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

#lightbox-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
}

#lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
#lightbox-close:hover { background: rgba(255,255,255,0.15); color: var(--text); }

/* Mobile tweaks */
@media (max-width: 480px) {
  body { padding: 12px 12px 24px; gap: 14px; }
  .header-bar { padding: 8px 12px; border-radius: 14px; }
  #gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .header-right .btn span { display: none; }
}
