:root {
  --bg: #0d0d10;
  --bg2: #16161c;
  --card: #1b1b22;
  --line: #2a2a34;
  --txt: #ece9f1;
  --muted: #8a8797;
  --pink: #ff4d8d;
  --purple: #a855f7;
  --orange: #ff8a3d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(168,85,247,.14), transparent 60%),
    radial-gradient(900px 500px at 10% 0%, rgba(255,77,141,.12), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: 'Vazirmatn', sans-serif;
  min-height: 100vh;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Hero ── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 3.4rem 1rem 2.6rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.hero-inner { position: relative; z-index: 2; }
.brand {
  font-family: 'Pacifico', cursive;
  font-size: clamp(3.2rem, 12vw, 6.5rem);
  line-height: 1;
  background: linear-gradient(100deg, var(--pink), var(--purple) 45%, var(--orange));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 30px rgba(168,85,247,.4));
  letter-spacing: 1px;
  animation: glow 4s ease-in-out infinite alternate;
}
@keyframes glow {
  from { filter: drop-shadow(0 6px 24px rgba(255,77,141,.35)); }
  to   { filter: drop-shadow(0 10px 40px rgba(168,85,247,.55)); }
}
.tagline {
  margin-top: .6rem;
  color: var(--muted);
  font-weight: 200;
  font-size: clamp(.95rem, 3vw, 1.2rem);
  letter-spacing: .5px;
}
.hero-actions {
  margin-top: 1.6rem;
  display: flex; gap: .9rem; justify-content: center; align-items: center;
  flex-wrap: wrap;
}
.btn-upload {
  border: none; cursor: pointer;
  padding: .8rem 1.7rem;
  border-radius: 999px;
  font-family: 'Vazirmatn'; font-weight: 800; font-size: 1rem;
  color: #fff;
  background: linear-gradient(100deg, var(--pink), var(--purple));
  box-shadow: 0 8px 26px rgba(255,77,141,.35);
  transition: transform .15s, box-shadow .2s;
}
.btn-upload:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 12px 34px rgba(168,85,247,.5); }
.btn-upload:active { transform: scale(.97); }
.count-badge {
  padding: .55rem 1rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: .85rem; font-weight: 600;
}

/* ── Sparkles ── */
.sparkle-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sparkle {
  position: absolute; top: -10%;
  opacity: .0;
  animation-name: drift; animation-iteration-count: infinite; animation-timing-function: linear;
}
@keyframes drift {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 0; }
  15% { opacity: .5; }
  85% { opacity: .5; }
  100% { transform: translateY(120px) rotate(180deg); opacity: 0; }
}

/* ── Admin banner ── */
.admin-banner {
  background: linear-gradient(90deg, rgba(255,138,61,.18), rgba(255,77,141,.18));
  border-bottom: 1px solid var(--line);
  text-align: center; padding: .6rem 1rem;
  color: #ffcda0; font-weight: 600; font-size: .9rem;
}

/* ── Main ── */
.main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.8rem 1rem 3rem; }

/* ── Dropzone ── */
.dropzone-wrap { margin-bottom: 2rem; }
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 20px;
  padding: 2.2rem 1rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255,255,255,.015);
  transition: border-color .2s, background .2s, transform .15s;
}
.dropzone:hover { border-color: var(--purple); background: rgba(168,85,247,.06); }
.dropzone.drag { border-color: var(--pink); background: rgba(255,77,141,.1); transform: scale(1.01); }
.dropzone.busy { opacity: .7; cursor: wait; }
.dz-icon { font-size: 2.6rem; margin-bottom: .5rem; }
.dz-text { font-weight: 600; font-size: 1.05rem; }
.dz-sub { color: var(--muted); font-size: .82rem; margin-top: .35rem; font-weight: 200; }

/* ── Masonry ── */
.masonry { column-gap: 14px; columns: 5 200px; }
.card {
  break-inside: avoid;
  margin: 0 0 14px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform .25s, box-shadow .25s;
  animation: pop .35s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.card.removing { animation: bye .28s ease forwards; }
@keyframes bye { to { opacity: 0; transform: scale(.85); } }
.card img { width: 100%; display: block; }
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0,0,0,.5); }
.card-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent 40%);
  opacity: 0; transition: opacity .2s;
}
.card:hover .card-overlay { opacity: 1; }
.del-btn {
  border: none; cursor: pointer;
  background: rgba(220,38,38,.92); color: #fff;
  padding: .4rem .7rem; border-radius: 10px;
  font-family: 'Vazirmatn'; font-weight: 700; font-size: .8rem;
  backdrop-filter: blur(4px);
}
.del-btn:hover { background: #ef4444; }

/* ── Empty ── */
.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-icon { font-size: 4rem; margin-bottom: 1rem; opacity: .7; }
.empty h2 { color: var(--txt); font-weight: 800; margin-bottom: .5rem; }
.empty p { font-weight: 200; }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,5,8,.94);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 100%; max-height: 90vh;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.lb-close {
  position: absolute; top: 18px; left: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.2rem;
  backdrop-filter: blur(6px);
}
.lb-close:hover { background: rgba(255,255,255,.25); }

/* ── Modal ── */
.modal-bg {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(5,5,8,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fade .2s ease;
}
.modal {
  width: 100%; max-width: 380px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 20px; padding: 2rem 1.6rem; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal.shake { animation: shake .5s; }
@keyframes shake {
  10%,90% { transform: translateX(-2px); }
  20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-8px); }
  40%,60% { transform: translateX(8px); }
}
.modal-lock { font-size: 2.4rem; margin-bottom: .5rem; }
.modal h3 { font-weight: 800; margin-bottom: .3rem; }
.modal-hint { color: var(--muted); font-size: .85rem; font-weight: 200; margin-bottom: 1.2rem; }
.pw-input {
  width: 100%; padding: .8rem 1rem; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--txt); font-family: 'Vazirmatn'; font-size: 1rem;
  text-align: center; outline: none; transition: border-color .2s;
}
.pw-input:focus { border-color: var(--purple); }
.pw-input.err { border-color: #ef4444; }
.err-msg { color: #ff7b7b; font-size: .82rem; margin-top: .6rem; }
.modal-actions { display: flex; gap: .7rem; margin-top: 1.4rem; }
.btn-ghost, .btn-primary {
  flex: 1; padding: .7rem; border-radius: 12px; cursor: pointer;
  font-family: 'Vazirmatn'; font-weight: 700; border: none; font-size: .95rem;
}
.btn-ghost { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--txt); }
.btn-primary { background: linear-gradient(100deg, var(--pink), var(--purple)); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem 1rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  background: linear-gradient(0deg, rgba(255,255,255,.015), transparent);
}
.footer-brand {
  font-family: 'Righteous', cursive; font-size: 1.4rem;
  background: linear-gradient(100deg, var(--pink), var(--purple));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.footer-links { display: flex; align-items: center; gap: 1rem; }
.admin-link {
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 1rem; transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-link:hover { border-color: var(--purple); color: var(--txt); }
.admin-link.active {
  width: auto; padding: 0 1rem; border-radius: 999px;
  font-family: 'Vazirmatn'; font-weight: 700; font-size: .85rem;
  color: #ffcda0; border-color: var(--orange);
}
.remix-link {
  color: var(--muted); text-decoration: none; font-size: .85rem;
  padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 999px;
  transition: all .2s;
}
.remix-link:hover { color: var(--txt); border-color: var(--pink); }
.footer-note { color: var(--muted); font-size: .78rem; font-weight: 200; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 120;
  background: var(--bg2); border: 1px solid var(--purple);
  color: var(--txt); padding: .7rem 1.3rem; border-radius: 999px;
  font-weight: 600; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Responsive columns ── */
@media (max-width: 1100px) { .masonry { columns: 4 180px; } }
@media (max-width: 800px)  { .masonry { columns: 3 150px; } .hero { padding: 2.4rem 1rem 2rem; } }
@media (max-width: 520px)  { .masonry { columns: 2 130px; } }