:root {
  --bg: #0b0c10;
  --card: #111319;
  --muted: #c7c9d1;
  --text: #e9ecf1;
  --accent: #8ab4f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial;
  background: linear-gradient(180deg, #0b0c10, #0f1320 40%, #0b0c10);
  color: var(--text);
  min-height: 100vh;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(11, 12, 16, 0.6);
  border-bottom: 1px solid #1f2331;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: clamp(20px, 3vw, 32px);
  margin: 0 0 8px;
  letter-spacing: 0.3px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.muted { color: var(--muted); font-size: 14px; }

.size { display: flex; align-items: center; gap: 8px; }

.size input[type="range"] { width: 180px; }

main { padding: 20px 16px 48px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb, 180px), 1fr));
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid #1f2331;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 18px rgba(0,0,0,0.25);
  transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover, .card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 16px 24px rgba(0,0,0,0.35);
}

.thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: #0d0f15;
}

.caption {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #243048;
  background: #121826;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}

.btn:hover, .btn:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.15);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 50;
}

.lightbox.open { display: grid; }

.viewer {
  position: relative;
  width: min(92vw, 1100px);
  height: min(86vh, 820px);
  background: #0a0d14;
  border: 1px solid #1f2331;
  border-radius: 18px;
  overflow: hidden;
}

.viewer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0a0d14;
}

.vbar {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(0deg, rgba(10, 13, 20, 0.9), rgba(10, 13, 20, 0.5), transparent);
}

.vtitle { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vactions { display: flex; gap: 8px; }

.ctrl {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 13, 20, 0.75);
  border: 1px solid #243048;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
}

.ctrl:hover { border-color: var(--accent); }

.prev { left: 10px; }
.next { right: 10px; }
.close { position: absolute; top: 10px; right: 10px; }
