:root {
  --bg: #0e0e10;
  --surface: #18181c;
  --surface-2: #222228;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f4f4f6;
  --hint: #8f8f99;
  --accent: #e0182d;
  --accent-2: #ff3b5c;
  --accent-rgb: 224, 24, 45;
  --danger: #ff4d5e;
  --radius: 22px;
  color-scheme: dark;
}

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

body {
  margin: 0;
  font-family: Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}

a { color: var(--accent-2); }

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- Шапка ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(14, 14, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  min-width: 0;
}

.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.5), 0 4px 14px rgba(var(--accent-rgb), 0.35);
}

.stats { display: flex; gap: 6px; flex-shrink: 0; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.stat svg { width: 16px; height: 16px; color: var(--accent-2); }

#nav {
  display: flex;
  gap: 6px;
  padding: 6px 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

#nav::-webkit-scrollbar { display: none; }

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--hint);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.35);
}

/* ---------- Общее ---------- */

#app { padding: 14px 14px 48px; }

h1 { font-size: 24px; margin: 0 0 8px; word-break: break-word; }
h2 { font-size: 17px; margin: 22px 0 10px; color: var(--hint); font-weight: 600; }
p { margin: 6px 0; white-space: pre-wrap; word-break: break-word; }

.muted { color: var(--hint); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Карточки коллекций ---------- */

.grid { display: flex; flex-direction: column; gap: 14px; }

.card {
  --tint: #ff3b5c;
  --tint-rgb: 255, 59, 92;
  position: relative;
  display: block;
  min-height: 150px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s;
}

a.card:active { transform: scale(0.985); }

.t-mixed { --tint: #ff3b5c; --tint-rgb: 255, 59, 92; }
.t-image { --tint: #ff4f8b; --tint-rgb: 255, 79, 139; }
.t-audio { --tint: #2fd39a; --tint-rgb: 47, 211, 154; }
.t-video { --tint: #8b7cff; --tint-rgb: 139, 124, 255; }
.t-sticker { --tint: #ff9a3d; --tint-rgb: 255, 154, 61; }
.t-link { --tint: #4da3ff; --tint-rgb: 77, 163, 255; }

.card-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--tint-rgb), 0.3) 0%, rgba(var(--tint-rgb), 0.08) 50%, var(--surface) 100%);
}

.card-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}

.card-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 14, 16, 0.92) 0%, rgba(14, 14, 16, 0.6) 55%, rgba(14, 14, 16, 0.3) 100%),
    linear-gradient(135deg, rgba(var(--tint-rgb), 0.22), transparent 60%);
}

.card-content { position: relative; padding: 20px 76px 20px 20px; }
.card.has-tag .card-content { padding-top: 48px; }

.card-head { display: flex; align-items: center; gap: 14px; min-width: 0; }

.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(var(--tint-rgb), 0.16);
  border: 1px solid rgba(var(--tint-rgb), 0.38);
  color: var(--tint);
  flex-shrink: 0;
}

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

.card-desc {
  margin-top: 10px;
  color: var(--hint);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(var(--tint-rgb), 0.14);
  border: 1px solid rgba(var(--tint-rgb), 0.35);
  color: var(--tint);
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--hint);
  font-weight: 600;
}

.tag {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
}

.tag.muted-tag { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: none; }

.arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ---------- Страница коллекции ---------- */

.head {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), var(--surface) 60%);
  border: 1px solid var(--line);
}

.head-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
}

.head.with-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(14, 14, 16, 0.35) 0%, rgba(14, 14, 16, 0.92) 100%);
}

.head > :not(.head-bg) { position: relative; z-index: 2; }

.badge {
  display: inline-block;
  margin: 8px 6px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.badge.danger {
  color: var(--danger);
  background: rgba(255, 77, 94, 0.12);
  border-color: rgba(255, 77, 94, 0.35);
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.item img, .item video { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.item.sticker img, .item.sticker video { object-fit: contain; padding: 6px; }
.item video[controls] { object-fit: contain; background: #000000; }
.item.audio, .item.link, .item.wide { grid-column: 1 / -1; }

.track { padding: 12px 14px; }
.track-title { padding-right: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track audio { width: 100%; margin-top: 8px; }

.link-item {
  display: block;
  padding: 14px 76px 14px 14px;
  color: #4da3ff;
  text-decoration: none;
  word-break: break-all;
}

.caption {
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
}

.tool svg { width: 15px; height: 15px; }
.tool.done { background: rgba(47, 211, 154, 0.85); }
.tool:disabled { opacity: 0.5; }

/* ---------- Кнопки и формы ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.28);
}

.btn:disabled { opacity: 0.6; cursor: default; }

.btn.secondary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}

.btn.danger {
  background: rgba(255, 77, 94, 0.12);
  border: 1px solid rgba(255, 77, 94, 0.35);
  color: var(--danger);
  box-shadow: none;
}

.btn.wide { width: 100%; margin-top: 14px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus { border-color: rgba(var(--accent-rgb), 0.7); }
input::placeholder, textarea::placeholder { color: var(--hint); }
input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--accent); }

textarea { min-height: 100px; resize: vertical; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; color: var(--hint); font-size: 13px; }

.range-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; }
.range-row span { white-space: nowrap; }

.toolbar, .row { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar select { max-width: 40%; }
.row { margin-top: 12px; flex-wrap: wrap; }
.row input { flex: 1 1 140px; }
.row select { flex: 0 0 140px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0;
}

.panel input, .panel select { background: var(--surface-2); }
.limits { margin-top: 8px; }

.vis-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  cursor: pointer;
}

.vis-option:has(input:checked) {
  border-color: rgba(var(--accent-rgb), 0.7);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.14), var(--surface) 70%);
}

.vis-option input { width: auto; margin-top: 3px; accent-color: var(--accent); }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.empty { grid-column: 1 / -1; text-align: center; color: var(--hint); padding: 48px 10px; }
.loader { text-align: center; color: var(--hint); padding: 48px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 14px;
  z-index: 100;
  max-width: 90%;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Минималистичные кнопки ---------- */

.btn {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.btn.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.btn.secondary:active { background: rgba(255, 255, 255, 0.06); }

.btn.danger {
  background: transparent;
  border: 1px solid rgba(255, 77, 94, 0.4);
  color: var(--danger);
}

.actions { gap: 6px; }

/* ---------- Музыкальные строки ---------- */

.item.audio {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.item.audio .tools { position: static; flex-shrink: 0; }
.item.audio .tool { background: transparent; color: var(--hint); width: 34px; height: 34px; }
.item.audio .tool svg { width: 18px; height: 18px; }

.track {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  cursor: pointer;
}

.play {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.track.active .play { background: var(--accent); }
.track-info { flex: 1; min-width: 0; }

.track-title {
  padding: 0;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track.active .track-title { color: var(--accent-2); }
.track-sub { font-size: 12px; color: var(--hint); margin-top: 2px; }

.bar {
  display: none;
  height: 4px;
  margin-top: 8px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.track.active .bar { display: block; }
.bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent-2); }

/* ---------- Просмотр картинок ---------- */

.item.image img, .item.sticker img { cursor: zoom-in; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  touch-action: none;
}

.lb.open { background: rgba(0, 0, 0, 0.92); }

.lb img {
  position: absolute;
  object-fit: contain;
  transition: transform 0.3s ease;
  transform-origin: 0 0;
  will-change: transform;

/* ---------- Просмотр видео ---------- */

.item.video video { cursor: zoom-in; }

.vplay {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.vplay svg { width: 20px; height: 20px; }

.lb video {
  position: absolute;
  background: #000000;
  transition: transform 0.3s ease;
  transform-origin: 0 0;
  will-change: transform;
}

.vplay {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.vplay svg { width: 18px; height: 18px; margin-left: 3px; }

.item.video { overflow: hidden; }

/* ---------- Окно новостей ---------- */

.news {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.8);
}

.news-card {
  width: 100%;
  max-width: 420px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 22px 20px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), var(--surface) 55%);
  border: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.18);
}

.news-card h1 { font-size: 22px; margin: 0 0 4px; }
.news-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.news-sec b { display: block; margin-bottom: 4px; color: var(--accent-2); font-size: 14px; }
.news-sec span { color: var(--text); font-size: 14px; line-height: 1.45; }