* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #eee;
  min-height: 100vh;
}
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
header h1 { font-size: 2rem; margin-bottom: 0.3rem; }
.subtitle { color: #8899aa; font-size: 0.95rem; }
#refreshBtn {
  margin-top: 1rem;
  padding: 0.5rem 1.5rem;
  background: #e94560;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
#refreshBtn:hover { background: #d63851; }
.toast {
  position: fixed; top: 1rem; right: 1rem;
  padding: 0.8rem 1.5rem;
  background: #2ecc71; color: white;
  border-radius: 8px;
  z-index: 999;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}
.photo-card {
  position: relative;
  background: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
  cursor: pointer;
}
.photo-card:hover { transform: translateY(-3px); }
.photo-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}
.photo-card .overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.8rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.photo-card .overlay span { font-size: 0.8rem; color: #aaa; }
.photo-card .overlay .qricon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #666;
}
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #555;
}
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
  background: #1a1a2e;
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  max-width: 350px;
  width: 90%;
  position: relative;
}
.modal-close {
  position: absolute; top: 0.5rem; right: 0.8rem;
  background: none; border: none;
  color: #666; font-size: 1.5rem;
  cursor: pointer;
}
.modal-content h3 { margin-bottom: 1rem; color: #ccc; }
#qrContainer { margin: 0 auto 1rem; display: flex; justify-content: center; }
#qrContainer img, #qrContainer canvas { border-radius: 8px; }
.download-btn {
  display: inline-block;
  padding: 0.6rem 2rem;
  background: #e94560;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s;
}
.download-btn:hover { background: #d63851; }
@media (max-width: 600px) {
  #gallery { grid-template-columns: 1fr 1fr; gap: 0.5rem; padding: 0.5rem; }
  .photo-card img { height: 180px; }
}