body, html {
  margin: 0;
  padding: 0;
  height: calc(100dvh - 40px);
  padding-top: 20px;
  background: #000;
  color: white;
  font-family: Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

#videoGallery {
  display: flex;
  gap: 20px;
  padding: 0 20px;
  height: calc(100dvh - 80px); /* dostosowane do paddingu i menu */
  box-sizing: border-box;
}

#mainVideo {
  flex: 0 0 70%;
  max-width: 70%;
  height: auto;
  max-height: 100%;
  background: black;
  object-fit: contain;
  box-shadow: none;
  border-radius: 0;
}

.video-thumbnails {
  flex: 0 0 30%;
  max-width: 30%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: 100%;
  padding: 10px;
}

/* Wrapper dla każdej miniaturki + tytuł */
.video-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Miniatury */
.thumb-video {
  width: 200px;  /* ustawiona szerokość miniaturki */
  cursor: pointer;
  border-radius: 0;
  border: none;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  transition: filter 0.3s, box-shadow 0.3s;
}

.thumb-video:hover,
.thumb-video:focus {
  filter: drop-shadow(0 0 6px orange);
  outline: none;
}

.thumb-video.active {
  box-shadow: 0 0 10px rgba(255, 153, 0, 0.6);
}

/* Tytuł miniatury */
.video-title {
  margin-top: 6px;
  font-size: 13px;
  color: #ccc;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
}

@media (max-width: 600px) {
  body, html {
    height: 100dvh;
    padding: 0;
  }
  
  #videoGallery {
    flex-direction: column;
    padding: 0 10px;
    height: 100dvh;  /* Ustalona wysokość, żeby zajęło ekran */
  }

  #mainVideo {
    max-width: 100%;
    flex: none;              /* Nie rośnie */
    max-height: calc(100dvh - 150px);
    margin-bottom: 15px;
  }

  .video-thumbnails {
    flex-grow: 1;            /* zajmuje pozostałe miejsce w pionie */
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 kolumny */
    gap: 10px;
    overflow-y: auto;       /* pionowe przewijanie */
    padding-bottom: 10px;
    height: auto;           /* pozwól flex rosnąć */
  }

  .video-thumb {
    width: 100%;            /* wypełnia komórkę grid */
  }

  .thumb-video {
    width: 100%;            /* szerokość wypełnia wrapper */
    height: auto;           /* zachowuje proporcje */
  }

  .video-title {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }
}
