html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* --- Control bar --- */
#control-bar {
  position: fixed;
  top: -60px;                /* hidden above viewport */
  left: 0;
  width: 100%;
  height: 60px;
  background: #222;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: top 0.3s ease;
  z-index: 1000;
}

#bar-trigger {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 20px;
  background: #444;
  color: #fff;
  text-align: center;
  line-height: 20px;
  cursor: pointer;
  z-index: 1001;
}

/* Hovering arrow or bar keeps bar visible */
#bar-trigger:hover + #control-bar,
#control-bar:hover {
  top: 0;
}

/* --- Gallery grid --- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: 200px;
  gap: 0;
  width: 100%;
}

.gallery-item {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Emblems --- */
.emblems {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 6px;
  z-index: 20;
}

.emblem {
  width: 24px;
  height: 24px;
  background-size: contain;
  background-repeat: no-repeat;
}

.emblem-pus { background-image: url('icons/pus.png'); }
.emblem-bj  { background-image: url('icons/bj.png'); }
.emblem-ass { background-image: url('icons/ass.png'); }
.emblem-fing{ background-image: url('icons/fing.png'); }
.emblem-tit { background-image: url('icons/tit.png'); }

/* --- Overlay --- */
#overlay {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}

#overlay img,
#overlay video {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

#overlay .emblems {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 10000;
}