:root {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --text: #1f1f1f;
  --text-secondary: #6b6b6b;
  --border: #e5e5e7;
  --accent: #1f1f1f;
  --accent-2: #4c6ef5;
  --badge-yandex: #ffcc00;
  --badge-vk: #0077ff;
  --badge-youtube: #ff0000;
  --badge-rutube: #00a3ff;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-family: 'Inter', system-ui, sans-serif; color: var(--text); }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
.header-inner { display: flex; flex-direction: column; gap: 4px; }
.site-title {
  font-size: 32px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-title i { color: var(--accent-2); }
.site-subtitle {
  color: var(--text-secondary);
  margin: 0;
  font-size: 15px;
}

/* ---------- hero / topic cloud ---------- */
.hero {
  background: var(--surface);
  padding: 32px 0 36px;
  border-bottom: 1px solid var(--border);
}
.hero-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 18px;
}
.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.topic-tag {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.topic-tag:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  transform: translateY(-1px);
}
.topic-tag[aria-pressed="true"] {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  box-shadow: 0 4px 12px rgba(76, 110, 245, .25);
}
.tag-w1 { font-size: 14px; }
.tag-w2 { font-size: 16px; }
.tag-w3 { font-size: 19px; }
.tag-w4 { font-size: 22px; }
.tag-w5 { font-size: 26px; }

/* ---------- workspace ---------- */
.workspace { padding: 36px 0 24px; }

.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.results-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

/* ---------- cards ---------- */
.podcast-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s ease, transform .2s ease;
}
.podcast-card:hover {
  box-shadow: 0 10px 24px rgba(31, 31, 31, .08);
  transform: translateY(-2px);
}
.card-top { display: flex; justify-content: space-between; }
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: -4px 0 0;
}
.meta-item {
  color: var(--text-secondary);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta-item i { font-size: 12px; }
.card-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
  flex-grow: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.card-actions .btn { flex: 1; }

.platform-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: #1f1f1f;
}
.badge-yandex { background: var(--badge-yandex); }
.badge-vk { background: var(--badge-vk); color: #fff; }
.badge-youtube { background: var(--badge-youtube); color: #fff; }
.badge-rutube { background: var(--badge-rutube); color: #fff; }

.btn-add {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
  font-weight: 600;
}
.btn-add:hover { background: #3a58d1; border-color: #3a58d1; color: #fff; }
.btn-add.is-added {
  background: #e8ecfd;
  border-color: #c7d1fb;
  color: var(--accent-2);
}

/* ---------- empty state ---------- */
.empty-state-message {
  text-align: center;
  padding: 24px 12px 8px;
}
.empty-icon { font-size: 26px; color: var(--accent-2); margin-bottom: 10px; display: block; }
.empty-state-message h2 {
  font-size: 20px;
  font-weight: 600;
  max-width: 560px;
  margin: 0 auto;
}
.demo-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 20px 0 10px;
}
.demo-card { opacity: .55; }
.demo-card .btn.disabled { pointer-events: none; }

/* ---------- no results ---------- */
.no-results {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
}
.no-results i { font-size: 26px; margin-bottom: 10px; display: block; }

/* ---------- skeleton ---------- */
.skeleton-card { gap: 12px; }
.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #ececee 25%, #f5f5f6 37%, #ececee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-badge { width: 90px; height: 18px; border-radius: 999px; }
.skeleton-title { width: 80%; height: 18px; }
.skeleton-meta { width: 50%; height: 11px; }
.skeleton-text { width: 100%; height: 12px; }
.skeleton-text.short { width: 60%; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ---------- sidebar (desktop) ---------- */
.playlist-sidebar {
  position: sticky;
  top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}
.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.playlist-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.playlist-count-badge {
  background: var(--accent-2);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}
.playlist-body { overflow-y: auto; }
.playlist-empty { color: var(--text-secondary); font-size: 14px; margin: 0; }

.playlist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.playlist-item:last-child { border-bottom: none; }
.playlist-item-body { flex-grow: 1; min-width: 0; }
.playlist-item-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.playlist-item-title a { color: var(--text); text-decoration: none; }
.playlist-item-title a:hover { color: var(--accent-2); }
.playlist-item-remove {
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 6px;
}
.playlist-item-remove:hover { color: #d63939; }

/* ---------- mobile bottom bar ---------- */
.mobile-playlist-btn {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1040;
  background: var(--accent-2);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(76, 110, 245, .35);
}
.mobile-playlist-btn .playlist-count-badge { background: #fff; color: var(--accent-2); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 32px;
  margin-top: 24px;
}
.site-footer p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0;
}

/* ---------- toast ---------- */
.toast-container { z-index: 1080; }

/* ---------- responsive < 768px ---------- */
@media (max-width: 767.98px) {
  .topic-cloud {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .topic-tag { flex: 0 0 auto; }
  .workspace { padding-bottom: 90px; }
  .site-title { font-size: 24px; }
  .hero-title { font-size: 18px; }
}
@media (min-width: 992px) {
  .mobile-playlist-btn { display: none !important; }
}
