:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --panel: #15171b;
  --panel-2: #1c2026;
  --line: #2b3038;
  --text: #f4f6f8;
  --muted: #a4adb9;
  --accent: #1f9d72;
  --accent-2: #e0b95c;
  --danger: #f26d6d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(12, 13, 16, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--accent);
  color: #06120e;
  font-size: 13px;
  font-weight: 860;
}

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

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(36vw, 360px);
  min-width: 180px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search svg {
  color: var(--muted);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.video-card:hover {
  border-color: rgba(31, 157, 114, 0.55);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(18px, 2.5vw, 30px);
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 36px);
}

.player-shell {
  min-width: 0;
}

.player-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050608;
  box-shadow: var(--shadow);
}

.player-frame iframe,
.empty-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.empty-player {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(31, 157, 114, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(224, 185, 92, 0.16), transparent 45%),
    #111318;
}

.empty-player[hidden] {
  display: none;
}

.play-symbol {
  display: grid;
  place-items: center;
  width: clamp(70px, 9vw, 112px);
  height: clamp(70px, 9vw, 112px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.play-symbol svg {
  width: 42%;
  height: 42%;
  fill: currentColor;
}

.now-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.source {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 720;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.vk-link {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 40px;
  border-radius: 8px;
  background: #2688eb;
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.sidebar {
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar-head span {
  color: var(--muted);
  font-size: 14px;
}

.status {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--danger);
}

.video-list {
  display: grid;
  gap: 10px;
}

.video-card {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.video-card.active {
  border-color: var(--accent);
  background: var(--panel-2);
}

.thumb {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #08090b;
}

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

.thumb-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  background: #20242b;
}

.duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: white;
  font-size: 12px;
}

.card-title {
  display: -webkit-box;
  margin: 2px 0 10px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 24px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .search {
    width: 100%;
  }

  .video-card {
    grid-template-columns: 124px minmax(0, 1fr);
  }

  h1 {
    font-size: 24px;
  }
}
