:root {
  --bg: #17212b;
  --section: #232e3c;
  --section-hover: #2b3a4d;
  --card: #1e2b39;
  --text: #ffffff;
  --hint: #7d8b99;
  --accent: #3390ec;
  --accent-hover: #4ba0f5;
  --accent-text: #ffffff;
  --border: rgba(255, 255, 255, 0.08);
  --danger: #ff6b6b;
  --radius: 14px;
  --radius-btn: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  padding: 16px 14px 40px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.app {
  max-width: 640px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* ---------- Шапка ---------- */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.app-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-subtitle {
  color: var(--hint);
  font-size: 15px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.back-arrow {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--section);
  color: var(--text);
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-arrow:active {
  background: var(--section-hover);
}

.page-header .avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--section);
  flex-shrink: 0;
}

.header-text {
  min-width: 0;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-subtitle {
  color: var(--hint);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Поиск ---------- */
.search {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-btn);
  border: none;
  background: var(--section);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search::placeholder {
  color: var(--hint);
}

.search:focus {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Список ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.row-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--section);
  border: none;
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

.row-card:active {
  background: var(--section-hover);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--section-hover);
  flex-shrink: 0;
}

.avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.streamer-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  color: var(--hint);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  margin-left: auto;
  color: var(--hint);
  font-size: 18px;
  flex-shrink: 0;
}

/* ---------- Категории (сетка) ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.cat-card {
  background: var(--section);
  border: none;
  border-radius: var(--radius);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text);
  cursor: pointer;
  min-height: 110px;
  justify-content: center;
}

.cat-card:active {
  background: var(--section-hover);
}

.cat-icon {
  font-size: 34px;
  line-height: 1;
}

.cat-name {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

/* ---------- Жанры (чипы) ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: var(--section);
  color: var(--hint);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.chip.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Записи ---------- */
.item-title {
  font-weight: 600;
}

.badge {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(51, 144, 236, 0.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.badge.tags {
  background: var(--section-hover);
  color: var(--hint);
  margin-right: 4px;
  font-weight: 500;
}

.item-note {
  color: var(--hint);
  font-size: 13px;
  margin-top: 3px;
}

/* ---------- Сезоны и серии ---------- */
.season-block {
  margin-bottom: 18px;
}

.season-title {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.season-title .num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ep-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--section);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.ep-text {
  flex: 1;
  min-width: 0;
}

.ep-label {
  font-weight: 600;
  font-size: 15px;
}

.ep-title {
  color: var(--hint);
  font-size: 13px;
}

.watch-btn {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.watch-btn:active {
  background: var(--accent-hover);
}

/* ---------- Состояния ---------- */
.empty {
  color: var(--hint);
  text-align: center;
  padding: 40px 20px;
  font-size: 15px;
}

.loading {
  color: var(--hint);
  text-align: center;
  padding: 60px 20px;
  font-size: 15px;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid var(--section);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
