:root {
  --bg: #0f0f0f;
  --bar: #181818;
  --panel: #1f1f1f;
  --border: #303030;
  --text: #f1f1f1;
  --muted: #aaa;
  --accent: #4c8dff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent);
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-left-color: #fff;
  border-right: 0;
  transform: translateX(2px);
}

.search {
  display: flex;
  flex: 1;
  max-width: 620px;
  margin: 0 auto;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 20px 0 0 20px;
  background: #121212;
  color: var(--text);
  font-size: 15px;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
}

.search button {
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 0 20px 20px 0;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.search button:hover {
  background: #2a2a2a;
}

main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.section-title {
  margin: 4px 0 14px;
  font-size: 19px;
  font-weight: 600;
}

.note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.note.error {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.35);
}

/* ---------- сетка ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px 16px;
}

.card {
  cursor: pointer;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card:hover .thumb img {
  transform: scale(1.03);
  transition: transform 0.25s ease;
}

.badge-dur,
.badge-live {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  font-size: 12px;
  font-weight: 600;
}

.badge-live {
  background: #cc0000;
}

.card-body {
  padding: 10px 2px 0;
}

.card-body h3 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-channel,
.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- скелетоны ---------- */

.skeleton {
  pointer-events: none;
}

.skeleton .thumb,
.skeleton .card-body span {
  background: linear-gradient(90deg, #1f1f1f 25%, #2a2a2a 50%, #1f1f1f 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton .card-body span {
  display: block;
  height: 12px;
  margin-bottom: 7px;
  border-radius: 4px;
}

.skeleton .card-body span:last-child {
  width: 60%;
}

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

/* ---------- просмотр ---------- */

.back {
  margin-bottom: 14px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.back:hover {
  background: #2a2a2a;
}

.player {
  max-width: 1280px;
}

video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  display: block;
}

.watch-title {
  max-width: 1280px;
  margin: 16px 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.watch-meta {
  max-width: 1280px;
  margin: 0 0 14px;
  color: var(--muted);
}

.quality {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.quality select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  margin-right: 9px;
  border-radius: 999px;
  background: rgba(76, 141, 255, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
