:root {
  --bg: #04101b;
  --bg-soft: #071e2f;
  --panel: rgba(8, 24, 39, 0.86);
  --panel-2: rgba(9, 29, 47, 0.95);
  --text: #e9f5ff;
  --muted: #94abc0;
  --primary: #17d8ad;
  --secondary: #1cb5e0;
  --accent: #ffca6b;
  --danger: #ff6b6b;
  --border: rgba(140, 183, 218, 0.26);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 400px at 10% -20%, rgba(28, 181, 224, 0.22), transparent 60%),
    radial-gradient(900px 360px at 110% -10%, rgba(255, 202, 107, 0.14), transparent 55%),
    linear-gradient(160deg, #020a12, #061626 45%, #03111f 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  top: -90px;
  right: -70px;
  background: #23d5bd;
}

.orb-2 {
  bottom: -100px;
  left: -80px;
  background: #ffb45f;
}

.loading-bar {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  z-index: 100;
  overflow: hidden;
  background: rgba(6, 17, 28, 0.5);
}

.loading-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 15px rgba(23, 216, 173, 0.8);
  animation: loading-slide 1.1s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes loading-slide {
  0% { left: -40%; }
  100% { left: 102%; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 12px;
  padding: 12px;
  background: rgba(4, 14, 24, 0.8);
  border-bottom: 1px solid rgba(140, 183, 218, 0.2);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 18px rgba(23, 216, 173, 0.95);
}

.brand-copy h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  letter-spacing: 0.8px;
  font-size: 1.35rem;
  line-height: 1;
}

.brand-copy p {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.search-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: rgba(9, 27, 43, 0.9);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font-size: 0.95rem;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.search-wrap input:focus {
  border-color: rgba(23, 216, 173, 0.72);
  box-shadow: 0 0 0 3px rgba(23, 216, 173, 0.16);
}

.search-wrap button,
.ghost-btn {
  border: 1px solid rgba(23, 216, 173, 0.32);
  border-radius: 12px;
  padding: 0 14px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.search-wrap button {
  color: #04211d;
  background: linear-gradient(125deg, #12d4a5, #4ce0c2);
}

.ghost-btn {
  color: var(--text);
  background: rgba(16, 42, 64, 0.84);
  border-color: rgba(140, 183, 218, 0.26);
}

.search-wrap button:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.container {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 12px auto 36px;
  padding: 0 10px;
  display: grid;
  gap: 10px;
}

.panel {
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(140, 183, 218, 0.22);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-header h3 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: 1.05rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.chip {
  border: 1px solid rgba(140, 183, 218, 0.26);
  background: rgba(10, 32, 50, 0.84);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 130ms ease, border-color 130ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 216, 173, 0.62);
}

.chip.active {
  border-color: rgba(23, 216, 173, 0.85);
  background: rgba(23, 216, 173, 0.16);
}

.video-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.card {
  border: 1px solid rgba(140, 183, 218, 0.24);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 38, 58, 0.96), rgba(10, 28, 43, 0.98));
  cursor: pointer;
  transform: translateY(0);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(23, 216, 173, 0.6);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #082337;
}

.card-body {
  padding: 10px;
}

.card h4 {
  margin: 0 0 4px;
  font-size: 0.89rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.loading-note {
  margin: 8px 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.loading-skeleton {
  border-radius: 12px;
  min-height: 138px;
  background: linear-gradient(100deg, rgba(11, 31, 47, 0.95) 20%, rgba(21, 57, 84, 0.95) 40%, rgba(11, 31, 47, 0.95) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.15s linear infinite;
  border: 1px solid rgba(140, 183, 218, 0.2);
}

.loading-chip {
  width: 92px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(100deg, rgba(11, 31, 47, 0.9) 20%, rgba(22, 54, 78, 0.9) 42%, rgba(11, 31, 47, 0.9) 62%);
  background-size: 200% 100%;
  animation: shimmer 1.15s linear infinite;
  border: 1px solid rgba(140, 183, 218, 0.2);
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pager-bottom {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(140, 183, 218, 0.2);
}

#pageInfo {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.player-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(1, 8, 14, 0.84);
  display: grid;
  place-items: center;
  padding: 10px;
}

.sheet-card {
  width: min(940px, 100%);
  max-height: 94vh;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(140, 183, 218, 0.26);
  background: linear-gradient(165deg, rgba(7, 23, 36, 0.97), rgba(5, 18, 29, 0.97));
  box-shadow: var(--shadow);
  padding: 12px;
}

.close-btn {
  float: right;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(140, 183, 218, 0.28);
  background: rgba(16, 38, 56, 0.95);
  color: var(--text);
  cursor: pointer;
}

#playerTitle {
  margin: 0 0 10px;
  font-family: "Syne", sans-serif;
  font-size: 1rem;
  padding-right: 42px;
}

#videoPlayer {
  width: 100%;
  border-radius: 12px;
  background: #000;
  margin-bottom: 10px;
}

.video-meta {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 10px;
}

.sheet-card h4 {
  margin: 8px 0;
  font-family: "Syne", sans-serif;
}

.toast {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 30;
  max-width: min(92vw, 360px);
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-left: 4px solid var(--danger);
  background: rgba(15, 33, 48, 0.95);
  padding: 10px 11px;
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

.reveal {
  animation: reveal 0.45s ease both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 14px 20px;
  }

  .search-wrap {
    max-width: 580px;
    justify-self: end;
    width: 100%;
  }

  .container {
    padding: 0 16px;
    gap: 14px;
  }

  .video-grid,
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 11px;
  }

  .panel {
    padding: 14px;
  }

  .pager {
    justify-content: flex-end;
  }
}
