body {
  font-family: system-ui, sans-serif;
  margin: 0;
  background: #181a1b;
  color: #fff;
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}
.logo {
  display: block;
  margin: 32px auto 0 auto;
  height: 150px;
}
.footer {
  text-align: center;
  color: #aaa;
  font-size: 0.8em;
  margin: 32px 0 12px 0;
  opacity: 0.7;
}
.footer a {
  color: inherit;
}
h1 {
  text-align: center;
  margin: 1em 0 0.5em 0;
  letter-spacing: 1px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 1em;
  max-width: 1200px;
  margin: auto;
}
.thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  background: #222;
  box-shadow: 0 2px 8px #0008;
  transition: transform 0.1s;
}
.thumb:focus,
.thumb:hover {
  outline: 2px solid #80bfff;
  transform: scale(1.03);
  z-index: 2;
}
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  max-width: 90vw;
  max-height: 80vh;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: none;
  position: relative;
  height: auto;
  box-sizing: border-box;
}
.modal-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  background: #111;
  touch-action: pan-x pan-y;
  transition: transform 0.15s;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  visibility: hidden;
}
.loading-bar {
  width: 80px;
  height: 4px;
  background: #333;
  margin: 0 auto 20px auto;
  border-radius: 2px;
  overflow: hidden;
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}
.loading-bar.active::after {
  content: '';
  display: block;
  width: 0;
  height: 100%;
  background: #6cc4ff;
  animation: loading-bar-anim 1s linear infinite;
}
@keyframes loading-bar-anim {
  0% { width: 0; }
  100% { width: 100%; }
}
.retry-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #222;
  border: 1px solid #6cc4ff;
  border-radius: 5px;
  padding: 10px 20px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
  display: none;
  z-index: 110;
  min-width: 100px;
  min-height: 44px;
  box-sizing: border-box;
}
.close {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 2.5em;
  color: #fff;
  cursor: pointer;
  z-index: 101;
  background: rgba(0,0,0,0.2);
  border-radius: 50%;
  padding: 0 12px;
  line-height: 1;
  user-select: none;
}
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0.5em;
  }
  .thumb {
    border-radius: 5px;
    min-height: 90px;
    max-height: 150px;
  }
  .modal-content {
    max-width: 100vw;
    max-height: 80vh;
  }
}