:root {
  --bg: #060608;
  --panel: #111115;
  --card: rgba(255, 255, 255, 0.035);
  --card-hi: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f5f5f7;
  --ink-2: #c8c8d0;
  --muted: #8b8b97;
  --faint: #5d5d69;
  --green: #5bd66f;
  --violet: #a094ff;
  --violet-bg: rgba(139, 124, 246, 0.16);
  --red: #ff6b61;
  --amber: #ffc94d;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --body: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- живой фон: мерцающие звёзды, плывущее свечение, падающие звёзды ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.sky-stars {
  position: absolute;
  inset: 0;
}

.sky-stars.s1 {
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 90px, rgba(255, 255, 255, 0.45) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 210px 180px, rgba(255, 255, 255, 0.55) 50%, transparent 51%);
  background-size: 320px 260px, 380px 300px, 440px 360px;
  animation: twinkle 4.6s ease-in-out infinite alternate;
}

.sky-stars.s2 {
  background-image:
    radial-gradient(1px 1px at 80px 220px, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 280px 40px, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 400px 150px, rgba(190, 180, 255, 0.6) 50%, transparent 51%);
  background-size: 300px 340px, 520px 280px, 610px 430px;
  animation: twinkle 6.8s ease-in-out -3s infinite alternate-reverse;
}

@keyframes twinkle {
  from {
    opacity: 0.7;
  }

  to {
    opacity: 0.22;
  }
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}

.aurora.a1 {
  top: -22%;
  left: -10%;
  width: 760px;
  height: 520px;
  background: radial-gradient(closest-side, rgba(139, 124, 246, 0.3), transparent);
  animation: drift-a 24s ease-in-out infinite alternate;
}

.aurora.a2 {
  top: -14%;
  right: -14%;
  width: 820px;
  height: 560px;
  background: radial-gradient(closest-side, rgba(91, 214, 111, 0.13), transparent);
  animation: drift-b 31s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.75;
  }

  to {
    transform: translate3d(9%, 12%, 0) scale(1.18);
    opacity: 1;
  }
}

@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.05);
    opacity: 1;
  }

  to {
    transform: translate3d(-10%, 9%, 0) scale(0.92);
    opacity: 0.65;
  }
}

.meteor {
  position: absolute;
  top: 9%;
  left: -18%;
  width: 150px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85));
  opacity: 0;
  animation: meteor 13s linear 2.5s infinite;
}

.meteor.m2 {
  top: 38%;
  width: 110px;
  animation-duration: 19s;
  animation-delay: 9s;
}

@keyframes meteor {
  0% {
    transform: rotate(17deg) translateX(0);
    opacity: 0;
  }

  1.5% {
    opacity: 1;
  }

  9% {
    opacity: 0.6;
  }

  12%,
  100% {
    transform: rotate(17deg) translateX(165vmax);
    opacity: 0;
  }
}

/* ---------- появление элементов ---------- */

/* Без конечного кадра: элемент приезжает в свой обычный вид, каким бы он ни был. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.enter {
  animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.toolbar.enter {
  animation-delay: 60ms;
}

.panel.second.enter {
  animation-delay: 90ms;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes bar-grow {
  from {
    transform: scaleY(0.15);
  }
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.icon {
  display: inline-flex;
  flex: none;
}

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

.small {
  font-size: 14px;
}

/* ---------- каркас ---------- */

.shell {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.rail-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.rail-item .icon,
.rail-item .avatar {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rail-item:hover {
  background: var(--card-hi);
  color: var(--ink);
}

.rail-item:not(.disabled):hover .icon,
.rail-item:hover .avatar {
  transform: scale(1.12);
}

.rail-item.active {
  background: var(--violet-bg);
  color: var(--violet);
}

.rail-item.disabled {
  color: var(--faint);
  cursor: default;
}

.rail-item.disabled:hover {
  background: none;
  color: var(--faint);
}

.rail-tip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #18181d;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}

.rail-item:hover .rail-tip,
.rail-item:focus-visible .rail-tip {
  opacity: 1;
}

.rail-space {
  flex: 1;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b9adff, #6f5bf0);
  color: #0b0b10;
  font-weight: 700;
  font-size: 15px;
}

.avatar.big {
  width: 52px;
  height: 52px;
  font-size: 22px;
}

.page {
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 64px clamp(20px, 3.2vw, 48px) 120px;
}

/* ---------- бренд и главная ---------- */

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row.big {
  gap: 16px;
}

.brand-mark {
  display: inline-flex;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.brand-row.big .brand-name {
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.1;
}

.home-head {
  margin: 32px 0 56px;
}

.home-sub {
  margin-top: 18px;
  color: var(--muted);
  font-size: 20px;
}

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

.tool {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  transition: border-color 0.2s, transform 0.2s;
}

a.tool:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.tool.soon {
  opacity: 0.72;
}

.tool-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  height: 148px;
  padding: 0 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: radial-gradient(120% 140% at 80% 0%, rgba(139, 124, 246, 0.14), transparent 60%), rgba(255, 255, 255, 0.02);
}

.art-number {
  font-family: var(--display);
  font-weight: 700;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.art-number.green {
  color: var(--green);
}

.art-number.violet {
  color: var(--violet);
}

.art-cap {
  color: var(--muted);
  font-size: 14px;
}

.art-bars {
  position: absolute;
  right: 22px;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80%;
}

.art-bars span {
  transform-origin: bottom;
  animation: bar-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: calc(300ms + var(--i, 0) * 60ms);
  width: 12px;
  border-radius: 4px 4px 0 0;
  background: rgba(255, 255, 255, 0.14);
}

.tool-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 16px 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.tool-text {
  flex: 1;
  margin: 0 16px;
  color: var(--muted);
  font-size: 17px;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 22px 16px 0;
  color: var(--violet);
  font-weight: 600;
}

.badge {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font: 500 12px/1.5 var(--body);
  letter-spacing: 0;
}

.badge.violet {
  border-color: transparent;
  background: var(--violet-bg);
  color: var(--violet);
}

.badge.green {
  border-color: transparent;
  background: rgba(91, 214, 111, 0.13);
  color: var(--green);
}

.select.sm {
  height: 38px;
  padding-left: 12px;
  padding-right: 34px;
  border-radius: 11px;
  background-position: right 12px center;
  font-size: 14px;
}

/* ---------- заголовок страницы и фильтры ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--violet);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.search {
  position: relative;
  flex: 1 1 260px;
}

.search .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search .input {
  padding-left: 46px;
}

.input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s, background 0.15s;
}

.input::placeholder {
  color: var(--faint);
}

.input:hover {
  border-color: var(--line-strong);
}

.input:focus {
  outline: none;
  border-color: var(--violet);
  background: rgba(139, 124, 246, 0.06);
}

.textarea {
  height: auto;
  min-height: 88px;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  width: auto;
  padding-right: 42px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.500 6 6.500l5-5' fill='none' stroke='%238b8b97' stroke-width='1.800' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

.select option {
  background: #16161b;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow-x: auto;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.seg:hover {
  color: var(--ink);
}

.seg.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.seg-count {
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.seg.active .seg-count {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.chips:empty {
  margin-bottom: 18px;
}

.chip {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 14px;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip.active {
  border-color: transparent;
  background: var(--violet-bg);
  color: var(--violet);
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.12s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.btn-primary {
  background: #f5f5f7;
  color: #0b0b0e;
}

.btn-primary:hover:not(:disabled) {
  background: #fff;
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: var(--red);
  color: #1a0605;
}

.btn-locked {
  border-color: var(--line);
  background: none;
  color: var(--faint);
  cursor: default;
}

.btn-sm {
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.grow {
  flex: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--card-hi);
  color: var(--ink);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet);
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

/* ---------- карточка ниши ---------- */

.niche-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.niche-grid .empty {
  grid-column: 1 / -1;
}

/* плитка ниши */
.tile {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  transition: border-color 0.2s;
}

.tile {
  position: relative;
  overflow: hidden;
  --accent: var(--green);
}

.tile.taken {
  --accent: var(--red);
}

.tile.mine {
  --accent: var(--violet);
}

/* цветная линия сверху показывает статус ниши */
.tile::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  opacity: 0.85;
}

.tile {
  transition: border-color 0.2s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

.tile:hover {
  border-color: var(--line-strong);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(-4px);
}

/* по цветной линии при наведении пробегает блик */
.tile::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent 35%, rgba(255, 255, 255, 0.9) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 120% 0;
  opacity: 0;
}

.tile:hover::after {
  opacity: 1;
  background-position: -20% 0;
  transition: background-position 0.9s ease-out;
}

.tile-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}

.flag {
  position: absolute;
  top: -5px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #121217;
  border-radius: 50%;
  background: #121217;
  font-size: 15px;
  line-height: 1;
}

.tile.mine {
  border-color: rgba(160, 148, 255, 0.45);
  background: linear-gradient(180deg, rgba(139, 124, 246, 0.1), rgba(255, 255, 255, 0.025));
}

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

.tile-avatar-link {
  display: inline-flex;
  flex: none;
  border-radius: 50%;
}

.tile-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #1a1a20;
}

.tile-avatar.letter {
  background: linear-gradient(135deg, hsl(var(--h1, 250) 55% 34%), hsl(var(--h2, 310) 60% 20%));
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
}

.tile-names {
  flex: 1;
  min-width: 0;
}

.tile-title {
  display: -webkit-box;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tile-title:hover {
  color: var(--violet);
}

.tile-subrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.tile-sub {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  flex: none;
  max-width: 55%;
  padding: 2px 10px;
  overflow: hidden;
  border: 1px solid rgba(91, 214, 111, 0.35);
  border-radius: 8px;
  background: rgba(91, 214, 111, 0.1);
  color: var(--green);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.red {
  border-color: rgba(255, 107, 97, 0.4);
  background: rgba(255, 107, 97, 0.1);
  color: var(--red);
}

.pill.violet {
  border-color: rgba(160, 148, 255, 0.4);
  background: var(--violet-bg);
  color: var(--violet);
}

.tile-videos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tile-videos.none {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 16 / 2.85;
  padding: 0 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.video {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #15151a;
}

.video img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.video:hover img {
  transform: scale(1.05);
}

.tile.taken .video img,
.tile.taken .tile-avatar {
  filter: grayscale(0.85) brightness(0.75);
}

.video-views {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(8, 8, 12, 0.85);
  font-size: 12px;
  font-weight: 700;
}

.tile-cells {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.cell {
  min-width: 0;
  padding: 12px 2px;
  text-align: center;
}

.cell + .cell {
  border-left: 1px solid var(--line);
}

.cell-value {
  overflow: hidden;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-value.green {
  color: var(--green);
}

.tile.taken .cell-value.green {
  color: var(--muted);
}

.cell-label {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tile-rating {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-width: 0;
}

.tile-votes {
  color: var(--muted);
  font-size: 13.5px;
}

.tile-rating .rating-num {
  font-size: 15px;
}

.tile-rating .fact {
  flex-basis: 100%;
  font-size: 14px;
}

.tile-foot {
  display: grid;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.tile-foot p {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tile-foot p span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-foot .dim {
  color: var(--faint);
  font-size: 12.5px;
}

.tile-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.icon-btn.boxed {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.channel-link {
  min-width: 0;
}

.channel-avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn .channel-name {
  max-width: 150px;
}

/* аватарка канала вместо превью */
.thumb.channel {
  display: grid;
  place-items: center;
}

.thumb.channel .thumb-blur {
  position: absolute;
  inset: 0;
  filter: blur(26px) saturate(1.3) brightness(0.6);
  transform: scale(1.4);
}

.thumb.channel .thumb-avatar {
  position: relative;
  width: auto;
  height: 58%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

a.thumb.channel:hover .thumb-avatar {
  transform: scale(1.04);
}

a.thumb.channel:hover .thumb-blur {
  transform: scale(1.4);
}

/* подробная карточка в окне */
.dialog.xl {
  width: min(1060px, calc(100vw - 32px));
}

.dialog .niche {
  padding: 0;
  border: 0;
  background: none;
}

.niche {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 40px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.niche.mine {
  border-color: rgba(160, 148, 255, 0.45);
  background: linear-gradient(180deg, rgba(139, 124, 246, 0.1), rgba(255, 255, 255, 0.025));
}

.taken .thumb > img:not(.thumb-blur),
.taken .thumb.placeholder {
  filter: grayscale(0.85) brightness(0.7);
}

.niche.taken .income {
  color: var(--muted);
}

.niche-main,
.niche-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #15151a;
}

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

a.thumb:hover img {
  transform: scale(1.03);
}

.thumb.placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, hsl(var(--h1, 250) 55% 26%), hsl(var(--h2, 310) 60% 14%));
}

/* без ролика превью ниже, чтобы карточка не была пустой */
.niche div.thumb.placeholder {
  aspect-ratio: 16 / 6;
}

.thumb-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 84px;
  color: rgba(255, 255, 255, 0.2);
}

.thumb-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  background: rgba(10, 10, 14, 0.78);
  font-size: 13px;
  font-weight: 500;
}

.niche-title {
  margin-top: 22px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.niche-tags {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.niche-desc {
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 17px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.niche-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  margin-top: auto;
  padding-top: 20px;
  color: var(--faint);
  font-size: 14px;
}

.niche-tools {
  display: inline-flex;
  gap: 2px;
}

.stat + .stat {
  margin-top: 18px;
}

.income {
  color: var(--green);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(44px, 5.2vw, 68px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.approx {
  margin-right: 6px;
  font-size: 0.4em;
  opacity: 0.7;
  vertical-align: middle;
}

.subs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.1;
}

.subs .icon {
  color: var(--muted);
}

.cap {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.rule {
  width: 100%;
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.rating-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stars {
  display: inline-flex;
  margin-left: -3px;
}

.star {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: rgba(255, 255, 255, 0.14);
}

.star {
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.star:hover {
  transform: scale(1.2);
}

.star:active {
  transform: scale(0.9);
}

.star-fill {
  position: absolute;
  left: 3px;
  top: 4px;
  height: 26px;
  overflow: hidden;
  color: var(--amber);
  pointer-events: none;
}

.star-fill .icon {
  width: 26px;
}

.stars.sm {
  margin-left: -2px;
}

.stars.sm .star {
  width: 24px;
  height: 28px;
}

.stars.sm .star-fill {
  left: 2px;
  top: 4px;
  height: 20px;
}

.stars.sm .star-fill .icon {
  width: 20px;
}

.stars.previewing .star-fill {
  width: 0 !important;
}

.stars.previewing .star.lit {
  color: #fff;
}

.rating-num {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
}

.rating-cap {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 22px 0 28px;
}

.fact {
  position: relative;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 16px;
}

.fact::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.fact.green::before {
  background: var(--green);
}

.fact.red::before {
  background: var(--red);
}

.fact.amber::before {
  background: var(--amber);
}

.fact.violet::before {
  background: var(--violet);
}

.niche-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 72px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 30px;
  text-align: center;
}

.empty h2 {
  font-family: var(--display);
  font-size: 22px;
}

.empty p {
  margin-bottom: 12px;
  color: var(--muted);
}

/* ---------- участники ---------- */

.members {
  display: grid;
  gap: 26px;
}

.panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
}

.panel-title {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 700;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.code-list {
  margin-top: 18px;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.code-row:last-child {
  padding-bottom: 0;
}

.code-info {
  flex: 1 1 200px;
  min-width: 0;
}

.member-groups {
  margin: 18px 0 4px;
}

.member-empty {
  padding: 18px 0 4px;
}

button.badge.group {
  border-color: var(--line-strong);
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

button.badge.group:hover {
  border-color: var(--violet);
  color: var(--violet);
}

.select.wide {
  width: 100%;
}

.invite {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.invite-side {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.invite-code {
  padding: 10px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--green);
  font: 600 20px/1.4 ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.08em;
  user-select: all;
}

.member-list {
  margin-top: 14px;
}

.member {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.member-info {
  flex: 1 1 260px;
  min-width: 0;
}

.member-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
}

.member-niches {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 50px;
}

.member-niches-label {
  color: var(--muted);
  font-size: 14px;
}

.member-niche {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  height: 36px;
  padding: 0 12px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  font-weight: 500;
}

.member-niche:hover {
  border-color: var(--violet);
  color: var(--violet);
}

.member-niche .channel-avatar.letter {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, hsl(var(--h1, 250) 55% 34%), hsl(var(--h2, 310) 60% 20%));
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 700;
}

.member-niche-note {
  flex: none;
  color: var(--faint);
  font-size: 13px;
  font-weight: 400;
}

.member-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- вход ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  backdrop-filter: blur(10px);
}

.auth-title {
  margin-top: 36px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 12px 0 30px;
  color: var(--muted);
}

.auth-form,
.form {
  display: grid;
  gap: 18px;
}

.auth-switch {
  margin-top: 24px;
  color: var(--muted);
  text-align: center;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-label {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.field-hint {
  color: var(--faint);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.form-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.more summary {
  width: max-content;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.more summary:hover {
  color: var(--ink);
}

.more[open] summary {
  margin-bottom: 14px;
}

.form-error {
  color: var(--red);
  font-size: 14px;
}

.form-error:empty {
  display: none;
}

/* ---------- диалоги и уведомления ---------- */

.dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: #121217;
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}

.dialog.wide {
  width: min(680px, calc(100vw - 32px));
}

.dialog[open] {
  animation: modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog[open]::backdrop {
  animation: fade-in 0.25s ease-out;
}

.dialog::backdrop {
  background: rgba(3, 3, 5, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-inner {
  padding: 30px;
}

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

.dialog-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.dialog-text {
  margin-bottom: 26px;
  color: var(--ink-2);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.dialog-actions.spread {
  justify-content: space-between;
}

.account {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

#toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #1a1a20;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  animation: toast-in 0.2s ease-out;
}

.toast.ok {
  border-color: rgba(91, 214, 111, 0.45);
}

.toast.error {
  border-color: rgba(255, 107, 97, 0.55);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- адаптив ---------- */

@media (max-width: 1479px) {
  .niche-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1099px) {
  .niche-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 699px) {
  .niche-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .niche {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .niche-meta {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: fixed;
    inset: auto 0 0 0;
    flex-direction: row;
    justify-content: space-around;
    height: auto;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(10, 10, 14, 0.92);
    backdrop-filter: blur(12px);
  }

  .rail-space,
  .rail-tip {
    display: none;
  }

  .page {
    padding: 36px 16px 130px;
  }

  .home-head {
    margin: 12px 0 36px;
  }

  .home-sub {
    font-size: 17px;
  }

  .niche {
    padding: 18px;
    border-radius: 24px;
  }

  .segmented,
  .select {
    width: 100%;
  }

  .seg {
    flex: 1 0 auto;
    justify-content: center;
    gap: 5px;
    padding: 0 6px;
    font-size: 14px;
  }

  .seg-count {
    font-size: 12px;
  }

  .form-row,
  .form-row.three {
    grid-template-columns: minmax(0, 1fr);
  }

  .member-niches {
    padding-left: 0;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .dialog-inner {
    padding: 22px;
  }

  #toasts {
    bottom: 92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
