/* GLOBAL RESET */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0c10;
  color: #eaeaea;
  overflow: hidden;
}

/* APP LAYOUT */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 10px;
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
}

.header h1 {
  margin: 0;
  font-size: 24px;
  color: #45a29e;
}

.viewer-fisheye {
  width: 46px;
  height: 46px;
  background: #111;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.08);
}

.viewer-fisheye-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.viewer-count {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.viewer-label {
  font-size: 9px;
  color: #aaa;
  margin-top: 2px;
}

/* MAIN CONTENT */
.main-content {
  display: flex;
  flex: 1;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
}

/* PLAYER */
.main-player {
  flex: 2;
  position: relative;
  min-width: 0;
}

.player-container {
  width: 100%;
  height: 70vh;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #333;
  position: relative;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* SIDEBAR */
.sidebar {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

/* CATEGORY TABS */
.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 0 0 auto;
}

.category-tab {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: 12px;
  background: #1c1f26;
  border: 1px solid #2f333b;
  border-radius: 8px;
  color: #ddd;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}

.category-tab:hover {
  background: #2a2e36;
}

.category-tab.active {
  background: #45a29e;
  color: #111;
  border-color: #45a29e;
}

/* UPDATES */
.updates-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  overflow: hidden;
  background: #1c1f26;
  border: 1px solid #2f333b;
  border-radius: 10px;
  padding: 8px 10px;
  flex: 0 0 auto;
  min-height: 40px;
}

.updates-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: #ffd54a;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.updates-track-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.updates-track {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

/* UPDATE CHIP */
.update-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  color: #fff;
  font-size: 12px;
}

.update-chip::before {
  content: "•";
  color: #ffd54a;
  font-size: 14px;
  line-height: 1;
}

/* TOP 10 VIEWED CHANNELS */
.top-10 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.top-10 h2 {
  margin: 0;
  font-size: 13px;
}

/* NEW: HORIZONTAL SCROLL FOR TOP 10 */
.top-10-channels {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 4px;
  padding-bottom: 4px;
}

.top-10-channels::-webkit-scrollbar {
  height: 6px;
}

.top-10-channels::-webkit-scrollbar-thumb {
  background: #45a29e;
  border-radius: 4px;
}

.top-10-card {
  flex: 0 0 60px; /* compressed width */
  min-height: 60px; /* compressed height */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  background: #1a1d23;
  border: 1px solid #2f333b;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  text-align: center;
}

.top-10-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.18);
}

.top-10-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  background: #111;
  padding: 2px;
}

.top-10-name {
  font-size: 8px;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.top-10-viewers {
  font-size: 7px;
  color: rgba(255,255,255,.7);
}

/* SEARCH */
.search-row {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.search-btn,
.fav-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: #1c1f26;
  border: 1px solid #2f333b;
  color: #fff;
  cursor: pointer;
  transition: .2s;
  font-size: 12px;
}

.search-btn:hover,
.fav-btn:hover {
  background: #45a29e;
  color: #111;
}

/* CHANNEL LIST */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: #1a1d23;
  border-radius: 8px;
  cursor: pointer;
  transition: .2s;
  border: 1px solid transparent;
  flex: 0 0 auto;
}

.channel-item:hover {
  background: #2a2e36;
}

.channel-item.active {
  border-color: #45a29e;
  background: #20262d;
}

.channel-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.channel-logo {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #111;
}

.channel-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.channel-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-online {
  font-size: 10px;
  color: #9aa3ad;
}

.fav-toggle {
  border: none;
  background: transparent;
  color: #ffd54a;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

/* RADIO OVERLAY */
#radioOverlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  overflow: hidden;
}

#radioOverlay.show {
  display: flex;
}

#radioBg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(12px);
  transform: scale(1.08);
  opacity: .85;
}

#radioOverlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

#radioOverlay > *:not(#radioBg) {
  position: relative;
  z-index: 2;
}

#radioLogo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  padding: 8px;
}

#radioTitle {
  margin-top: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: #45a29e;
  border-radius: 4px;
}

/* MOBILE RESPONSIVE */
@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .app {
    padding: 0;
    gap: 0;
  }

  .header {
    padding: 10px;
  }

  .header h1 {
    font-size: 22px;
  }

  .main-content {
    flex-direction: column;
    gap: 0;
    height: 100%;
  }

  .main-player {
    flex: none;
    height: 27vh;
    width: 100%;
  }

  .player-container {
    height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 73vh;
    overflow: hidden;
    padding: 8px;
    min-width: 0;
  }

  .category-tabs {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #0b0c10;
    padding: 2px 0 4px;
  }

  .category-tab {
    padding: 7px 10px;
    font-size: 11px;
  }

  .updates-bar {
    padding: 7px 9px;
    min-height: 36px;
  }

  .updates-label {
    font-size: 10px;
  }

  .update-chip {
    font-size: 11px;
    margin-right: 18px;
  }

  .top-10 h2 {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .top-10-card {
    min-height: 55px;
    flex: 0 0 55px;
    padding: 4px 2px;
    gap: 2px;
  }

  .top-10-logo {
    width: 24px;
    height: 24px;
  }

  .top-10-name {
    font-size: 7px;
    min-height: 14px;
  }

  .top-10-viewers {
    font-size: 6px;
  }

  .search-btn,
  .fav-btn {
    font-size: 11px;
    padding: 8px 6px;
  }

  .channel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .channel-item {
    padding: 7px;
  }

  .channel-logo {
    width: 28px;
    height: 28px;
  }

  .channel-name {
    font-size: 11px;
  }

  .channel-online {
    font-size: 9px;
  }
}
