body {
  margin: 0;
  font-family: sans-serif;
  background-color: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

header {
  background: #111;
  padding: 1rem;
  text-align: center;
  font-size: 1.5rem;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  overflow: visible;
  gap: 1rem;
  padding: 1.2rem 1.8rem;
  min-height: auto;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #123357 0%, #102846 50%, #0c223c 100%);
  box-shadow: inset 0 0 32px rgba(0,0,0,0.25);
}

#main-player,
#main-video,
#main-video-details {
  display: none;
}

#video-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  background: #1c3f65;
  padding: 1.25rem;
  border-radius: 18px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.35);
  max-height: none;
  overflow-y: visible;
}

.video-item {
  margin-bottom: 1rem;
  cursor: pointer;
  text-align: center;
}

.video-card {
  background: #265884;
  border: 1px solid #3a76a8;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border 0.2s, box-shadow 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  margin: 0.15rem;
  padding: 0.75rem;
  gap: 0.45rem;
  box-shadow: 0 12px 26px rgba(0,0,0,0.25);
}
.video-card:hover {
  transform: translateY(-2px);
  border-color: #66ccff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.35);
}
.thumb-wrap {
  width: 100%;
  background: #000;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 0.4rem;
}
.video-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.video-title {
  font-size: 0.95rem;
  margin: 0.35rem 0.5rem 0.6rem;
  color: #eee;
}

.main-video-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 4px;
}
.main-video-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #66ccff;
}
.category-pill {
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  background: #111a;
  color: #f66;
  border: 1px solid #f66;
  font-weight: 600;
  margin-right: 6px;
}
.main-video-socials {
  margin: 10px 0 6px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.main-video-socials button {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #66ccff;
  background: #222;
  color: #fff;
  cursor: pointer;
}
.main-video-socials.no-share {
  color: #bbb;
}
.main-video-description {
  margin: 16px 0;
  color: #ccc;
  font-size: 1.05rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.main-video-description .desc-toggle {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #66ccff;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.main-video-description .desc-toggle:hover {
  background: #66ccff;
  color: #111;
  border-color: #66ccff;
}

.modal-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.modal-nav .nav-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #66ccff;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.modal-nav .nav-btn:hover {
  background: #66ccff;
  color: #111;
  border-color: #66ccff;
}

#main-video-details {
  padding: 1.25rem;
  background: rgba(17,17,17,0.85);
  border: 1px solid #222;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  max-width: none;
  width: 100%;
  margin: 0 0 1rem;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #0b0b0b;
  border-bottom: 1px solid #222;
}
.filter-input,
.filter-select {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  border: 2px solid #66ccff;
  background: #111;
  color: #fff;
  font-size: 1.05rem;
}
.filter-input { flex: 1; min-width: 240px; }

.chips-wrap {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-height: none;
  overflow: hidden;
}
.chips-wrap:not(.expanded) {
  max-height: 72px; /* roughly two lines of chips */
}
.chip {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #66ccff;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.chip.active {
  background: #66ccff;
  color: #111;
  border-color: #66ccff;
}
.chips-toggle {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 2px solid #ff7a18;
  background: linear-gradient(135deg, #ff8c2e, #af002d);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 6px 14px rgba(175, 0, 45, 0.35);
}
.chips-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(175, 0, 45, 0.45);
}

.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: linear-gradient(135deg, #ff4d4d, #c40000);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(196,0,0,0.35);
  z-index: 1200;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(196,0,0,0.45);
}

/* Modal */
.viewer-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1rem;
}
.viewer-modal-overlay.open { display: flex; }
.viewer-modal {
  background: #0d0d0d;
  border: 2px solid #66ccff;
  border-radius: 12px;
  padding: 1rem;
  max-width: 960px;
  width: 95%;
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  position: relative;
}
.viewer-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: #222;
  color: #fff;
  border: 2px solid #66ccff;
  border-radius: 50%;
  width: 96px;
  height: 96px;
  cursor: pointer;
  font-size: 54px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  z-index: 10;
  pointer-events: auto;
}
.viewer-modal video {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}
.viewer-modal #modal-details {
  margin-top: 0.75rem;
}
.main-video-description {
  position: relative;
}
.main-video-description .desc-text {
  max-height: none;
  overflow: visible;
}
.main-video-description.collapsed .desc-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.main-video-description .desc-toggle {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #66ccff;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.main-video-description .desc-toggle:hover {
  background: #66ccff;
  color: #111;
  border-color: #66ccff;
}
.main-video-socials {
  margin: 10px 0 6px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.main-video-socials button {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #66ccff;
  background: #222;
  color: #fff;
  cursor: pointer;
}
.main-video-socials.no-share {
  color: #bbb;
}
.main-video-description {
  margin: 16px 0;
  color: #ccc;
  font-size: 1.05rem;
  line-height: 1.4;
}

#main-video-details {
  padding: 1rem;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 1rem;
  background: #0b0b0b;
  border-bottom: 1px solid #222;
}
.filter-input,
.filter-select {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 2px solid #66ccff;
  background: #111;
  color: #fff;
}
.filter-input { flex: 1; min-width: 160px; }
