@charset "UTF-8";

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  font-family: sans-serif;
  background: #dddde0;
  overflow: hidden;
}

#viewer-container {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
}

model-viewer {
  margin-top: auto;
  margin-bottom: auto;
  width: 85vw;
  height: 85vh;
}

#loadingContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

#loadingContainer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

#loadingBarWrapper, #cancelButton, #loadingText {
  position: relative;
  z-index: 2;
}

#loadingBarWrapper {
  width: 25%;
  height: 2.5vh;
  border: 1px solid #ccc;
  background-color: rgba(255,255,255,0.9);
  border-radius: 0.5rem;
  margin-top: 1rem;
}

#loadingBar {
  background-color: #4CAF50;
  height: 100%;
  width: 0%;
  border-radius: 0.5rem 0 0 0.5rem;
}

#loadingText {
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
  background-color: rgba(0,0,0,0.4);
  border-radius: 0.3rem;
  padding: 0.2rem 0.5rem;
  font-size: 1rem;
  margin-top: 1rem;
}

#cancelButton {
  margin-top: 2rem;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  display: none;
  z-index: 2;
}

#thumbnail-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 15vw;
  height: 90vh;
  overflow-y: auto;
  padding: 1rem 0;
}

.model-thumb, #thumbnail-toggle {
  margin: 0;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1.2rem;
  object-fit: cover;
}

.model-thumb:hover, .model-thumb.active, #thumbnail-toggle:hover {
  border: 2px solid #4CAF50;
}

#close-overlay-button {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 13;
  padding: 0.1rem;
  background: #666;
  color: #fff;
  border: none;
  border-radius: 0.3rem;
  font-size: 1.2rem;
}

#thumbnail-toggle {
  display: none;
}

/*▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼*/
/*▼メディアクエリに関しての記述はここから▼*/

@media (max-width: 768px) {
  body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 95%;
    padding: 2em 0 1rem 0;
  }
  #viewer-container {
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  model-viewer {
    margin-top: auto;
    margin-bottom: auto;
    width: 98vw;
    min-height: 60vh;
  }

  #thumbnail-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.1rem;
    gap: 0.2rem;
  }

  .model-thumb {
    flex: 0 0 auto;
  }

  .model-thumb.hidden {
    display: none;
  }

  #thumbnail-toggle {
    display: flex;
    flex: 0 0 auto;
  }

  #thumbnail-list.more {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ccc;
    padding: 6rem 2rem 2rem 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 90px;
    gap: 0.2rem;
    height: 100vh;
    overflow-y: auto;
    z-index: 12;
    justify-items: center;
    box-sizing: border-box;
  }

  #thumbnail-list.more .model-thumb {
    display: flex !important;
  }

  #thumbnail-list.more #thumbnail-toggle {
    display: none !important;
  }
}
