:root {
  color-scheme: dark;
  --bg: #0e0e18;
  --fg: #f2f2f7;
  --muted: #9aa0b4;
  --accent: #8b7bff;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.top {
  padding: 24px 16px 8px;
  text-align: center;
}
.top h1 {
  margin: 0;
  font-size: 1.4rem;
}
.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
#main {
  padding: 16px;
  min-height: 50vh;
}
.state {
  text-align: center;
  color: var(--muted);
  margin-top: 15vh;
  padding: 0 24px;
  line-height: 1.6;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-width: 1100px;
  margin: 0 auto;
}
.cell {
  padding: 0;
  border: none;
  background: #1a1a2a;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  cursor: pointer;
}
.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 20px;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  z-index: 50;
}
.lightbox img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 10px;
  object-fit: contain;
}
.lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}
.lb-download {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.lb-download:disabled {
  opacity: 0.6;
}
