* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  background: #000;
  min-height: 100%;
}

/* ── Grid Container ── */
#grid {
  position: relative;
  width: 100%;
  padding-bottom: 44px;
}

.grid-cell {
  position: absolute;
  opacity: 0;
  transition: transform 0.4s ease-in-out, opacity 0.5s ease;
  cursor: pointer;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: layout style paint;
}

.grid-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}

.grid-cell:hover {
  z-index: 2;
}

.grid-cell:hover img {
  box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.grid-cell-blank {
  background: transparent;
  pointer-events: none;
}

/* ── Effects System ── */
#fx-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  display: none;
}
#fx-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 6px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#fx-buttons {
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}
.fx-label {
  font: 8px/1 monospace;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 2px;
}
.fx-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}
.fx-btn {
  min-width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.5);
  font: 9px/28px monospace;
  text-align: center;
  cursor: pointer;
  padding: 0 4px;
  transition: all 0.3s;
  letter-spacing: -0.5px;
}
.fx-btn:hover {
  border-color: rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.8);
}
.fx-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.7);
}
.fx-reset {
  letter-spacing: 0;
  color: rgba(255,100,100,0.6);
  border-color: rgba(255,100,100,0.3);
}
.fx-reset:hover {
  color: rgba(255,100,100,0.9);
  border-color: rgba(255,100,100,0.6);
}
.fx-gif {
  letter-spacing: 0;
  color: rgba(100,255,100,0.6);
  border-color: rgba(100,255,100,0.3);
}
.fx-gif:hover {
  color: rgba(100,255,100,0.9);
  border-color: rgba(100,255,100,0.6);
}
.fx-rec-badge {
  font: bold 9px/1 monospace;
  color: #f44;
  animation: rec-blink 0.8s ease-in-out infinite;
  margin-left: 2px;
}
@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
  padding: 20px;
  user-select: none;
}

.lightbox-nav.prev {
  left: 10px;
}

.lightbox-nav.next {
  right: 10px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
  #fx-nav {
    padding: 4px 6px;
  }
  #fx-buttons {
    gap: 3px;
  }
  .fx-btn {
    min-width: 24px;
    height: 24px;
    font: 8px/24px monospace;
    padding: 0 3px;
  }
  .fx-label {
    font-size: 7px;
  }
  .fx-sep {
    height: 16px;
    margin: 0 2px;
  }
  #audio-player {
    height: 34px;
  }
  #audio-player .ap-btn {
    font-size: 12px;
    padding: 0 8px;
    height: 34px;
    line-height: 34px;
  }
  #audio-track-name {
    font-size: 8px;
  }
  #audio-time {
    font-size: 7px;
  }
  .lightbox-close {
    top: 10px;
    right: 15px;
    font-size: 24px;
  }
  .lightbox-nav {
    font-size: 28px;
    padding: 15px;
  }
  .lightbox img {
    max-width: 96vw;
    max-height: 88vh;
  }
}
@media (max-width: 768px) and (min-width: 481px) {
  .fx-btn {
    min-width: 26px;
    height: 26px;
    font: 8px/26px monospace;
  }
  #audio-player {
    height: 36px;
  }
  #audio-player .ap-btn {
    height: 36px;
    line-height: 36px;
  }
}

/* ── Audio Player ── */
#audio-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 250;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 0;
  font-family: monospace;
  color: #ccc;
  display: flex;
  align-items: center;
  height: 38px;
  gap: 0;
  user-select: none;
}
#audio-player .ap-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
  padding: 0 10px;
  height: 38px;
  line-height: 38px;
  transition: color 0.2s;
  font-family: monospace;
}
#audio-player .ap-btn:hover { color: #fff; }
#audio-player .ap-btn.playing { color: #fff; }
#audio-track-name {
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  padding: 0 8px;
  text-transform: uppercase;
}
#audio-progress-wrap {
  flex: 2;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 0;
  cursor: pointer;
}
#audio-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
#audio-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  transition: width 0.15s linear;
}
#audio-time {
  font-size: 8px;
  color: rgba(255,255,255,0.3);
  padding-right: 10px;
  white-space: nowrap;
  font-family: monospace;
}
