body {
  background: #0e0e10;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  text-align: center;
  padding: 15px;
  margin: 0;
  min-height: 100vh;
}

/* Container for top controls */
.top-controls {
  position: relative;
  width: 100%;
  height: 80px;
  margin-bottom: 20px;
}

/* Music Player */
.music-player {
  position: absolute;
  top: 0;
  left: 0;
  background: #18181b;
  border: 2px solid #538139;
  border-radius: 8px;
  padding: 8px 12px;
  z-index: 1000;
  min-width: 200px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.music-btn {
  background: #538139;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-btn:hover {
  background: #44702f;
}

.music-title {
  display: none;
}

.volume-slider-wrapper {
  position: relative;
  width: 90px;
  height: 4px;
  background: #0e0e10;
  border-radius: 2px;
}

.volume-slider-wrapper::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 4px;
  width: var(--volume-percent, 50%);
  background: #538139;
  border-radius: 2px;
  z-index: 1;
}

.volume-slider {
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border-radius: 2px;
  outline: none;
  margin: 0;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  cursor: pointer;
}

.music-player-emote {
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin-left: 4px;
}

.volume-slider::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
  border-radius: 2px;
}

.volume-slider::-moz-range-track {
  background: transparent;
  height: 4px;
  border-radius: 2px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #538139;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  margin-top: -4px;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #538139;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Progress fill for Firefox */
.volume-slider::-moz-range-progress {
  background: #538139;
  height: 4px;
  border-radius: 2px;
}

.social-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #9146ff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  transition: background 0.2s;
}

#youtubeBtn {
  background: #ff0000;
}

.social-btn:hover {
  opacity: 0.8;
}

.social-icon {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Top Right Social Icons */
.top-right-social {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 8px;
  z-index: 1000;
  align-items: center;
}


.top-right-social .social-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #18181b;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#twitchBtn {
  background: #9146ff;
}

#twitchBtn:hover {
  background: #7c3aed;
}

#youtubeBtn {
  background: #ff0000;
}

#youtubeBtn:hover {
  background: #cc0000;
}

.top-right-social .social-icon {
  width: 30px;
  height: 30px;
}

.action-btn {
  background: #18181b;
  border: 2px solid #538139;
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn:hover {
  background: #538139;
}

/* Search Container with Buttons */
.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  position: relative;
}

.search-left-buttons {
  display: flex;
  gap: 8px;
}

.search-right-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Surprise Me Container */
.surprise-me-container {
  position: relative;
  z-index: 1000;
}

.surprise-btn {
  background: #18181b;
  border: 2px solid #538139;
  border-radius: 8px;
  padding: 8px 16px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surprise-btn:hover {
  background: #538139;
}

/* Surprise Emote Display */
.surprise-emote-display {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: #18181b;
  border: 2px solid #538139;
  border-radius: 8px;
  padding: 15px;
  z-index: 998;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  max-width: 280px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.surprise-emote-display::after {
  content: '';
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 77px;
  height: 2px;
  background: #538139;
  opacity: 0;
  transition: opacity 0.2s;
}

.surprise-emote-display:has(.surprise-download-btn:hover) img {
  transform: translateY(-4px);
}

.surprise-emote-display:has(.surprise-download-btn:hover)::after {
  opacity: 1;
}

.surprise-emote-display .close-surprise {
  position: absolute;
  top: 2px;
  right: 2px;
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
  z-index: 10;
}

.surprise-emote-display .close-surprise:hover {
  background: #dc3545;
}

#surpriseEmoteContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

#surpriseEmoteContent img {
  max-width: 100%;
  max-height: 77px;
  width: auto;
  height: auto;
  border-radius: 6px;
  /* background: #0e0e10; */
  transition: transform 0.2s;
}

#surpriseEmoteContent .emote-name {
  font-size: 14px;
  color: #efeff1;
  font-weight: 500;
  text-align: center;
}

#surpriseEmoteContent .surprise-download-btn {
  background: #538139;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

#surpriseEmoteContent .surprise-download-btn:hover {
  background: #44702f;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 30px 0;
  padding: 20px 0;
  flex-wrap: wrap;
}

.pagination-btn {
  background: #18181b;
  border: 2px solid #538139;
  border-radius: 6px;
  padding: 8px 12px;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 40px;
}

.pagination-btn:hover {
  background: #538139;
}

.pagination-btn.active {
  background: #538139;
  font-weight: bold;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

h1 {
  margin-bottom: 20px;
  color: #efeff1;
  font-size: 2rem;
}

.banner-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.banner {
  max-width: 250px;
  width: 90%;
  height: auto;
  margin-top: -120px;
  margin-bottom: -55px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#search {
  padding: 12px;
  width: 300px;
  max-width: 90%;
  border-radius: 8px;
  border: 2px solid #18181b;
  background: #18181b;
  color: white;
  font-size: 14px;
  transition: border-color 0.2s;
  flex: 0 0 auto;
}

#search:focus {
  outline: none;
  border-color: #538139;
}

#search::placeholder {
  color: #adadb8;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(8, 140px);
  gap: 30px;
  justify-content: center;
}

/* Mobile Responsive Styles */
@media (max-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(6, 140px);
  }
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  
  .top-controls {
    height: 70px;
    margin-bottom: 15px;
  }
  
  .music-player {
    padding: 8px;
    min-width: auto;
    width: auto;
  }
  
  .music-controls {
    flex-direction: column;
    gap: 6px;
    align-items: center;
  }
  
  .volume-slider-wrapper {
    width: 4px;
    height: 60px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .volume-slider-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 4px;
    height: calc(var(--volume-percent, 50%) * 60px / 100);
    background: #538139;
    border-radius: 2px;
    z-index: 1;
  }

  .volume-slider {
    width: 4px;
    height: 60px;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    writing-mode: bt-lr;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    -webkit-touch-callout: none;
  }

  .volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #538139;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  .top-right-social {
    flex-direction: column;
    gap: 5px;
  }

  .top-right-social #youtubeBtn {
    order: -1;
  }

  .top-right-social #twitchBtn {
    order: 1;
  }

  .top-right-emote {
    width: 35px;
    height: 35px;
  }

  .top-right-social .social-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .top-right-social .social-icon {
    width: 30px;
    height: 30px;
  }

  .search-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 80px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 8px;
  }

  .search-left-buttons,
  .search-right-buttons {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
    justify-content: center;
    align-items: center;
    max-width: 50%;
  }

  .search-left-buttons .action-btn,
  .search-right-buttons .action-btn,
  .search-right-buttons .surprise-me-container {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - 4px);
  }

  .search-left-buttons .action-btn,
  .search-right-buttons .action-btn {
    min-width: 80px;
    width: 100%;
  }

  #search {
    width: 100%;
    order: 999;
  }

  .action-btn {
    padding: 10px 8px;
    font-size: 13px;
    min-height: 40px;
    min-width: 80px;
    width: 100%;
  }

  .surprise-me-container {
    position: relative;
  }
  
  .surprise-btn {
    padding: 10px 12px;
    font-size: 14px;
    white-space: nowrap;
    min-height: 40px;
  }
  
  .banner-wrapper .surprise-emote-display {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px;
    width: 75%;
    max-width: 280px;
    min-width: 200px;
    min-height: 180px;
    max-height: none;
    overflow-y: visible;
    z-index: 10000;
    box-sizing: border-box;
    margin-top: -100px;
    margin-bottom: -55px;
  }

  /* Reserve space so nothing moves when banner/display switches */
  body:has(.surprise-emote-display:not([style*="display: none"])) .banner {
    visibility: hidden;
  }
  
  #surpriseEmoteContent {
    width: 100%;
    gap: 10px;
  }

  #surpriseEmoteContent img {
    max-width: 100%;
    max-height: 100px;
    width: auto;
    height: auto;
  }
  
  .surprise-emote-display::after {
    display: none;
  }
  
  .banner-wrapper .banner {
    margin-top: -80px !important;
    margin-bottom: -35px;
  }
}

@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  
  .emote img {
    width: 60px;
    height: 60px;
  }
  
  .emote::after {
    top: 60px;
    width: 60px;
  }
  
  .emote button {
    padding: 4px 12px;
    font-size: 11px;
  }
  
  .top-controls {
    height: 60px;
    margin-bottom: 10px;
  }
  
  .music-player {
    padding: 6px;
    min-width: auto;
  }
  
  .music-controls {
    flex-direction: column;
    gap: 5px;
  }
  
  .music-btn {
    min-width: 20px;
    height: 20px;
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .volume-slider-wrapper {
    width: 4px;
    height: 50px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .volume-slider-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 4px;
    height: calc(var(--volume-percent, 50%) * 50px / 100);
    background: #538139;
    border-radius: 2px;
    z-index: 1;
  }

  .volume-slider {
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    -webkit-touch-callout: none;
  }

  .volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #538139;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .volume-slider {
    width: 4px;
    height: 50px;
    -webkit-appearance: slider-vertical; /* WebKit browsers */
    appearance: slider-vertical; /* Standard property for compatibility */
    writing-mode: bt-lr;
  }
  
  .top-right-emote {
    width: 30px;
    height: 30px;
  }

  .top-right-social {
    flex-direction: column;
  }

  .top-right-social #youtubeBtn {
    order: -1;
  }

  .top-right-social #twitchBtn {
    order: 1;
  }

  .top-right-social .social-btn {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .top-right-social .social-icon {
    width: 30px;
    height: 30px;
  }

  .search-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 8px;
  }

  .search-left-buttons,
  .search-right-buttons {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
    justify-content: center;
    align-items: center;
    max-width: 50%;
  }

  .search-left-buttons .action-btn,
  .search-right-buttons .action-btn,
  .search-right-buttons .surprise-me-container {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - 4px);
  }

  .search-left-buttons .action-btn,
  .search-right-buttons .action-btn {
    min-width: 75px;
    width: 100%;
  }

  #search {
    width: 100%;
    order: 999;
  }

  .action-btn {
    padding: 10px 8px;
    font-size: 12px;
    min-height: 38px;
    min-width: 75px;
    width: 100%;
  }

  .surprise-me-container {
    position: relative;
  }
  
  .surprise-btn {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 38px;
  }
  
  .banner-wrapper .surprise-emote-display {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 18px;
    width: 70%;
    max-width: 240px;
    min-width: 180px;
    min-height: 160px;
    max-height: none;
    overflow-y: visible;
    z-index: 10000;
    box-sizing: border-box;
    margin-top: -70px;
    margin-bottom: -35px;
  }

  .surprise-emote-display::after {
    display: none;
  }

  /* Reserve space so nothing moves when banner/display switches */
  body:has(.surprise-emote-display:not([style*="display: none"])) .banner {
    visibility: hidden;
  }
  
  .banner-wrapper .banner {
    max-width: 200px;
    margin-top: -80px !important;
    margin-bottom: -35px;
  }
  
  #search {
    width: 90%;
    padding: 10px;
    font-size: 13px;
  }
  
  .pagination {
    gap: 5px;
    margin: 20px 0;
  }
  
  .pagination-btn {
    padding: 6px 10px;
    font-size: 11px;
    min-width: 35px;
  }
}

@media (max-width: 400px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  
  .emote img {
    width: 50px;
    height: 50px;
  }
  
  .emote::after {
    top: 50px;
    width: 50px;
  }
  
  .banner-wrapper .banner {
    margin-top: -80px !important;
    margin-bottom: -35px;
  }
}

/* .emote {
  background: #18181b;
  padding: 1px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
 */
.emote {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.emote::after {
  content: '';
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 2px;
  background: #538139;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Move only the image up when hovering download button */
.emote:has(button:hover) img {
  transform: translateY(-4px);
}

.emote:has(button:hover)::after {
  opacity: 1;
}

.emote img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 6px;
  background: #0e0e10;
  transition: transform 0.2s;
}

.emote-name {
  margin-top: 8px;
  font-size: 12px;
  color: #efeff1;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

.emote button {
  background: #538139;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

.emote button:hover {
  background: #44702f;
}

.emote button:active {
  background: #44702f;
}

/* ADMIN PAGE */
.admin {
  max-width: 500px;
  margin: auto;
  text-align: left;
}

.admin h1 {
  text-align: center;
}

.admin input, .admin textarea {
  width: 100%;
  padding: 6px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 2px solid #18181b;
  background: #18181b;
  color: white;
  font-size: 13px;
  box-sizing: border-box;
}

.admin input:focus, .admin textarea:focus {
  outline: none;
  border-color: #538139;
}

.admin textarea {
  height: 120px;
  font-family: 'Courier New', monospace;
  resize: vertical;
  font-size: 12px;
  padding: 8px;
}

.admin button {
  padding: 6px 12px;
  background: #538139;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
  width: auto;
  margin-bottom: 0;
}

.admin button:hover {
  background: #44702f;
}

.admin button:active {
  background: #365e26;
}

.admin h2 {
  color: #efeff1;
  margin-top: 0;
}
