* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0d0d0d;
  color: #eee;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* Login */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #111;
}

.login-box {
  background: #1a1a1a;
  padding: 2.5rem;
  border-radius: 8px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-box h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-box input {
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0d0d0d;
  color: #eee;
  font-size: 1rem;
}

.login-box button {
  padding: 0.75rem;
  background: #e50914;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover { background: #f40612; }

.error {
  color: #e50914;
  font-size: 0.875rem;
  text-align: center;
}

/* App layout */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #141414;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #e50914;
  white-space: nowrap;
}

#search {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0d0d0d;
  color: #eee;
  font-size: 0.95rem;
}

.btn-ghost {
  margin-left: auto;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #444;
  border-radius: 6px;
  color: #aaa;
  cursor: pointer;
}

.btn-ghost:hover { border-color: #666; color: #eee; }

.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Channel list */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: #141414;
  border-right: 1px solid #222;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-tabs {
  display: flex;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.section-tab {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  background: #111;
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.section-tab:hover { color: #ccc; background: #1a1a1a; }

.section-tab.active {
  color: #fff;
  background: #141414;
  box-shadow: inset 0 -2px 0 #e50914;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.category-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0d0d0d;
  color: #eee;
  font-size: 0.85rem;
  cursor: pointer;
}

.category-select:focus {
  outline: none;
  border-color: #555;
}

.sidebar-header .sidebar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-header .count {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #666;
  font-size: 0.75rem;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border: 1px solid #444;
  border-radius: 4px;
  background: #222;
  color: #aaa;
  cursor: pointer;
}

.btn-small:hover { border-color: #666; color: #eee; }
.btn-small:disabled { opacity: 0.4; cursor: not-allowed; }

.verify-progress {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #888;
  background: #1a1a1a;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.channel-list {
  display: block;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

.virtual-track {
  position: relative;
  width: 100%;
}

.virtual-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 58px;
  box-sizing: border-box;
  padding: 0 1rem;
  cursor: pointer;
  border-bottom: 1px solid #1e1e1e;
  transition: background 0.15s;
}

.channel-item:hover { background: #1e1e1e; }

.channel-item.active {
  background: #2a1214;
  border-left: 3px solid #e50914;
  padding-left: calc(1rem - 3px);
}

.channel-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  background: #222;
  flex-shrink: 0;
}

.channel-item .no-logo {
  width: 36px;
  height: 36px;
  background: #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #666;
  flex-shrink: 0;
}

.channel-item .info {
  overflow: hidden;
}

.channel-item .name {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-item .group {
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player */
.player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  min-width: 0;
}

.player-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#video {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 120px);
  background: #000;
}

#video.hidden { display: none; }

.player-placeholder {
  position: absolute;
  color: #555;
  font-size: 1.1rem;
  pointer-events: none;
}

.player-placeholder.hidden { display: none; }

.now-playing {
  padding: 1rem 1.5rem;
  background: #141414;
  border-top: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.now-playing-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1;
}

.now-playing h2 {
  font-size: 1.1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zap-controls {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.zap-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: #222;
  color: #eee;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.zap-btn:hover {
  background: #333;
  border-color: #666;
}

.zap-btn:active {
  background: #e50914;
  border-color: #e50914;
}

.zap-hint {
  font-size: 0.75rem;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

.group-tag {
  font-size: 0.8rem;
  color: #888;
  background: #222;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.empty-msg {
  padding: 2rem;
  text-align: center;
  color: #666;
}

@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; max-height: 40vh; }
  .zap-hint { display: none; }
}
