* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #12121f; color: #eee; font-family: sans-serif; padding: 32px; min-height: 100vh; }

.auth-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.auth-bar h1 { font-size: 12px; color: #555; letter-spacing: 2px; text-transform: uppercase; }
.auth-info { font-size: 11px; color: #666; display: flex; align-items: center; gap: 12px; }
.btn-auth { padding: 6px 14px; border: none; border-radius: 7px; font-size: 11px; cursor: pointer; font-weight: 500; }
.btn-login  { background: #5865F2; color: white; }
.btn-login:hover  { background: #4752c4; }
.btn-logout { background: #252540; color: #888; }
.btn-logout:hover { background: #303060; color: #ccc; }
.btn-upload { background: #3a7d3a; color: #9ef09e; }
.btn-upload:hover { background: #2d612d; }

.grid { display: flex; flex-wrap: wrap; gap: 16px; }

.card {
  background: #1a1a30; border: 1px solid #2a2a50; border-radius: 14px;
  width: 200px; overflow: hidden; box-shadow: 0 4px 20px #0005;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: #5865F2; transform: translateY(-3px); }

.card-img-wrap {
  position: relative; height: 180px; background: #0d0d1a;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-img { image-rendering: pixelated; width: 320px; height: 320px; object-fit: contain; flex-shrink: 0; transition: opacity .1s; }

.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: #00000077; border: none; color: #ffffffaa; font-size: 20px;
  width: 28px; height: 44px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s; z-index: 2;
}
.nav-btn:hover { background: #5865F2cc; color: white; }
.nav-btn.prev { left: 4px; }
.nav-btn.next { right: 4px; }
.card-img-wrap:hover .nav-btn { opacity: 1; }

.zoom-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #ffffff15; border: 1.5px solid #ffffff25; color: #ffffffbb;
  font-size: 20px; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s; z-index: 3;
}
.zoom-btn:hover { background: #5865F2bb; border-color: #5865F2; }
.card-img-wrap:hover .zoom-btn { opacity: 1; }

.frame-counter { position: absolute; bottom: 5px; right: 8px; font-size: 9px; color: #ffffff44; pointer-events: none; }

.card-body { padding: 11px; }
.card-name { font-size: 13px; font-weight: bold; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 9px; color: #555; margin-bottom: 8px; }
select {
  width: 100%; background: #0d0d1a; color: #7090d0; border: 1px solid #2a2a50;
  border-radius: 6px; padding: 4px 7px; font-size: 10px; margin-bottom: 8px; cursor: pointer; outline: none;
}
select:hover { border-color: #5865F2; }
.card-actions { display: flex; gap: 5px; }
.btn { flex: 1; padding: 6px 4px; border: none; border-radius: 7px; font-size: 10px; cursor: pointer; font-weight: 500; }
.btn-dl { background: #5865F2; color: white; }
.btn-dl:hover { background: #4752c4; }
.btn-rnd { background: #252540; color: #888; }
.btn-rnd:hover { background: #303060; color: #ccc; }

#lightbox {
  display: none; position: fixed; inset: 0;
  background: #000000cc; z-index: 100;
  align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
}
#lightbox.open { display: flex; }
.lb-inner {
  position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
#lb-img {
  image-rendering: pixelated;
  max-width: min(80vw, 560px);
  max-height: 68vh;
  filter: drop-shadow(0 0 40px #5865F244);
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: #ffffff15; border: 1.5px solid #ffffff25;
  color: white; font-size: 30px; width: 46px; height: 68px;
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-nav:hover { background: #5865F2bb; border-color: #5865F2; }
.lb-prev { left: -62px; }
.lb-next { right: -62px; }
#lb-label { font-size: 12px; color: #7090d0; letter-spacing: 1px; }
#lb-counter { font-size: 11px; color: #444; }
.lb-close {
  position: absolute; top: -44px; right: 0;
  background: none; border: none; color: #666; font-size: 22px;
  cursor: pointer; padding: 4px; line-height: 1;
}
.lb-close:hover { color: white; }
.loading { text-align: center; color: #444; padding: 60px; font-size: 13px; }
