body.gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background-color: #222;
  color: #eee;
  min-height: 100vh;
}

.page-title {
  margin-bottom: 20px;
  font-weight: 600;
  letter-spacing: 1.5px;
}

/* Gallery container */
#gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  max-width: 1400px;
  width: 100%;
}

/* Gallery items */
.gallery-item {
  background-color: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

img.gallery-item {
  height: auto;
  max-height: 280px;
  width: auto;
  max-width: 100%;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

video.gallery-item {
  max-height: 280px;
  max-width: 100%;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  background: black;
}

.gallery-item:hover,
.gallery-item:focus {
  transform: scale(1.1);
  z-index: 5;
  box-shadow: 0 8px 30px rgba(0, 255, 255, 0.4);
}

.text-item {
  display: inline-block;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  overflow-y: auto;
  color: #ccc;
  white-space: pre-wrap;
  border-radius: 8px;
  background: linear-gradient(145deg, #1e1e2e, #181824);
  border: 1px solid #2a2a3a;
}

/* Scrollbar styling */
.text-item::-webkit-scrollbar {
  width: 8px;
}

.text-item::-webkit-scrollbar-thumb {
  background: #00ffff55;
  border-radius: 4px;
}

.text-item::-webkit-scrollbar-track {
  background: transparent;
}

/* Modal */
#modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 18, 23, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9999;
}

#modal.active {
  opacity: 1;
  pointer-events: all;
}

#modal-content {
  max-width: 90vw;
  max-height: 90vh;
  background: #0d0d14;
  border-radius: 16px;
  box-shadow: 0 0 40px #00ffffaa;
  overflow: auto;
  position: relative;
  padding: 20px;
  color: #eee;
  user-select: text;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#modal-content img,
#modal-content video {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  margin-bottom: 15px;
  box-shadow: 0 0 20px #00ffffaa;
}

#modal-text {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 1.1rem;
  white-space: pre-wrap;
  line-height: 1.5;
  padding: 10px 15px;
  background: linear-gradient(135deg, #222236, #191927);
  border-radius: 10px;
  border: 1px solid #00ffffaa;
  width: 100%;
}

#modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: #00ffff;
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

#modal-close:hover {
  color: #66ffff;
}

/* Mobile tweaks */
@media (max-width: 350px) {
  .gallery-item,
  img.gallery-item,
  video.gallery-item,
  .text-item {
    width: 90vw;
    height: auto;
    min-height: 150px;
  }
}
