@charset "UTF-8";
/* ============================================================
   DORAE — публичная часть
   ============================================================ */

/* Колонки через grid, а не fixed + margin: при дробном зуме браузер
   больше не округляет ширину и отступ по-разному, поэтому край не дрожит. */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  align-items: start;
}

/* ---------- сайдбар ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  padding: 24px 18px;
  background: var(--surface);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* собственный слой композиции — иначе размытие шапки оставляет следы */
  transform: translateZ(0);
  contain: paint;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  font-size: 18px;
  cursor: pointer;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  flex: 0 0 auto;
  object-fit: cover;
  background: var(--surface-2);
}
.brand-mark.lg { width: 44px; height: 44px; border-radius: 10px; }

.nav-group { display: grid; gap: 4px; }
.nav-label {
  padding: 0 10px 8px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-item {
  border: 0;
  width: 100%;
  background: transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--trans), color var(--trans);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.nav-item.active .nav-badge { background: rgba(6, 24, 30, .18); color: var(--on-accent); }

.sidebar-user {
  margin-top: auto;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  border: 0;
  text-align: left;
  color: inherit;
  font-family: inherit;
  transition: background var(--trans);
}
.sidebar-user:hover { background: var(--surface-3); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  flex: 0 0 auto;
  overflow: hidden;
}
.sidebar-user strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: var(--muted); }

/* ---------- топбар ---------- */
.main { min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  /* изоляция слоя: без неё при зуме шапка «размазывается» по странице */
  isolation: isolate;
  will-change: backdrop-filter;
}
.topbar-title { display: none; font-weight: 900; font-size: 18px; letter-spacing: .06em; }
.topbar-brand {
  display: none;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  letter-spacing: .16em;
  font-size: 15px;
  flex: 0 0 auto;
  min-width: 0;
}
.topbar-brand img { width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto; object-fit: cover; }
.topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-button {
  border: 0;
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  min-height: 42px;
  min-width: 260px;
  max-width: 480px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--trans), color var(--trans);
}
.search-button:hover { background: var(--surface-2); color: var(--text); }
.search-button svg { width: 19px; height: 19px; flex: 0 0 auto; }
.search-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-button kbd {
  margin-left: auto;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 3px 7px;
  color: var(--soft);
  font-size: 11px;
  font-family: inherit;
}
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-button.has-dot { position: relative; }
.icon-button.has-dot::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- страницы ---------- */
.page {
  display: none;
  padding: 12px 24px 110px;
  max-width: var(--content);
  margin: 0 auto;
  animation: pageIn 220ms ease;
}
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  margin: 18px 0 22px;
}
.page-head h1 { margin: 0; font-size: clamp(28px, 4vw, 52px); line-height: 1; letter-spacing: -.055em; }
.page-head p { margin: 9px 0 0; color: var(--muted); max-width: 720px; }

.section { margin-top: 34px; }
.section-head { display: flex; gap: 16px; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: clamp(20px, 2.4vw, 30px); letter-spacing: -.04em; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.section-link { border: 0; background: transparent; color: var(--accent); font-weight: 900; cursor: pointer; padding: 5px 0; font-family: inherit; }
.section-link:hover { text-decoration: underline; }

/* ---------- герой ---------- */
/* Карусель: слайды лежат в одной ячейке грида, поэтому высота контейнера
   равна самому высокому слайду и вёрстка не прыгает при смене. */
.hero-slider { position: relative; }
.hero-track { display: grid; }
.hero-track > .hero { grid-area: 1 / 1; }

.hero {
  position: relative;
  min-height: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: end;
  padding: clamp(28px, 5vw, 64px);
  background: linear-gradient(135deg, #242623 0%, #0e0f0e 70%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 520ms ease;
}
.hero.is-active { opacity: 1; visibility: visible; pointer-events: auto; }

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: rgba(10, 10, 10, .55);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity var(--trans), background var(--trans);
}
.hero-nav.prev { left: 16px; }
.hero-nav.next { right: 16px; }
.hero-nav:hover { background: rgba(10, 10, 10, .8); }
.hero-slider:hover .hero-nav, .hero-nav:focus-visible { opacity: 1; }
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 22%;
  transform: scale(1.03);
  transition: transform 700ms ease;
}
.hero:hover .hero-bg { transform: scale(1.06); }
.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(16,16,15,.97) 0%, rgba(16,16,15,.85) 42%, rgba(16,16,15,.15) 78%),
    linear-gradient(to top, rgba(16,16,15,.95), transparent 62%),
    radial-gradient(circle at 82% 26%, rgba(82,226,255,.18), transparent 30%),
    radial-gradient(circle at 92% 74%, rgba(158,140,255,.3), transparent 28%);
}
.hero-symbol {
  position: absolute;
  right: 6%;
  top: 6%;
  font-size: clamp(110px, 18vw, 250px);
  line-height: .7;
  font-weight: 900;
  color: rgba(82, 226, 255, .07);
  letter-spacing: -.15em;
  transform: rotate(-8deg);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: 640px; }
.hero-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; color: var(--accent); font-weight: 900; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: clamp(40px, 6.4vw, 82px); letter-spacing: -.07em; line-height: .9; max-width: 620px; }
.hero .hero-original { color: var(--soft); margin: 10px 0 0; font-weight: 700; letter-spacing: .04em; }
.hero p { color: #c5c2b8; font-size: 15px; max-width: 580px; margin: 18px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-dots { position: absolute; right: 26px; bottom: 24px; z-index: 3; display: flex; gap: 6px; }
.hero-dots button {
  width: 26px; height: 5px; border: 0; border-radius: 3px;
  background: rgba(255,255,255,.25); cursor: pointer; padding: 0;
  transition: background var(--trans), width var(--trans);
}
.hero-dots button.active { background: var(--accent); width: 40px; }

/* ---------- карточки-постеры ---------- */
.drama-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.drama-grid.wide-gap { gap: 18px 14px; }
.drama-card { min-width: 0; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: inherit; font-family: inherit; }
.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  transition: transform var(--trans), filter var(--trans), box-shadow var(--trans);
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.drama-card:hover .poster { transform: translateY(-4px); filter: saturate(1.1); box-shadow: var(--shadow-1); }
.poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.8), transparent 52%); pointer-events: none; }
.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  text-align: center;
  font-weight: 900;
  letter-spacing: -.03em;
  color: rgba(255,255,255,.72);
  background: linear-gradient(150deg, var(--f1, #2a2b28), #101010 72%);
  font-size: 15px;
}
.poster-top { position: absolute; z-index: 2; inset: 9px 9px auto; display: flex; justify-content: space-between; align-items: start; gap: 6px; }
.poster-bottom { position: absolute; z-index: 2; inset: auto 10px 10px; }
.poster-bottom strong { display: block; font-size: 12px; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poster-progress { height: 4px; background: rgba(255,255,255,.24); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.poster-progress span { display: block; height: 100%; background: var(--accent); }
.poster-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--trans);
}
.poster-play span {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
}
.drama-card:hover .poster-play { opacity: 1; }
.card-title { font-size: 14px; margin: 9px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Строка «страна · год · серии». Без обрезки длинные значения вроде
   «Тайваньские, китайские» вылезали за карточку и наезжали на соседнюю. */
.card-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.35;
}
.card-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-meta span:first-child { flex: 0 1 auto; }
.card-meta span + span { flex: 0 0 auto; }

/* ---------- продолжить просмотр ---------- */
.continue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.continue-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  cursor: pointer;
  border: 0;
  text-align: left;
  color: inherit;
  font-family: inherit;
  transition: background var(--trans);
}
.continue-card:hover { background: var(--surface-2); }
.continue-card .poster { aspect-ratio: 16 / 10; }
.continue-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.continue-copy h3 { margin: 0 0 5px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.continue-copy .line-progress { margin-top: 12px; }

/* ---------- промо-карточки ---------- */
.feature-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; }
.feature-card, .metric-card, .collection-card, .schedule-card, .rank-card, .analytics-card, .profile-card, .filter-panel, .detail-card {
  background: var(--surface);
  border-radius: var(--radius);
}
.feature-card { min-height: 170px; padding: 20px; position: relative; overflow: hidden; cursor: pointer; border: 0; text-align: left; color: inherit; font-family: inherit; }
.feature-card h3 { font-size: 22px; margin: 7px 0 7px; letter-spacing: -.04em; }
.feature-card p { color: var(--muted); max-width: 310px; margin: 0; }
.feature-card .giant { position: absolute; right: 12px; bottom: -28px; font-size: 110px; font-weight: 900; color: rgba(255,255,255,.05); line-height: 1; letter-spacing: -.06em; }
.feature-card.accent-bg { background: var(--accent); color: var(--on-accent); }
.feature-card.accent-bg p { color: rgba(6,24,30,.68); }
.feature-card.accent-bg .giant { color: rgba(6,24,30,.1); }
.feature-card.accent-bg .eyebrow { color: var(--on-accent); }
.feature-card.purple-bg { background: #7464d9; color: #fff; }
.feature-card.purple-bg p { color: rgba(255,255,255,.75); }
.feature-card.purple-bg .eyebrow { color: #fff; }

/* ---------- фильтры каталога ---------- */
.filter-panel { padding: 14px; margin-bottom: 16px; display: grid; grid-template-columns: 1.3fr repeat(4, minmax(140px, .7fr)) auto; gap: 8px; align-items: center; }
.filter-control {
  min-width: 0;
  min-height: 42px;
  border: 1px solid transparent;
  outline: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
  transition: border-color var(--trans), background var(--trans);
}
.filter-control:hover { background: var(--surface-3); }
.filter-control:focus { border-color: var(--accent-line); }
.filter-control::placeholder { color: var(--soft); }
.filter-panel .ui-select-button { min-height: 42px; }
.catalog-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.catalog-summary strong { font-size: 15px; }

/* ---------- подборки ---------- */
.collections-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.collection-card { min-height: 220px; padding: 18px; position: relative; overflow: hidden; cursor: pointer; border: 0; text-align: left; color: inherit; font-family: inherit; display: flex; flex-direction: column; gap: 6px; }
.collection-card:nth-child(2n) { background: #24231f; }
.collection-card h3 { margin: 0; font-size: 22px; letter-spacing: -.04em; max-width: 220px; }
.collection-card p { color: var(--muted); max-width: 230px; margin: 0; font-size: 13px; }
.collection-card .pill { align-self: flex-start; margin-top: auto; position: relative; z-index: 2; }
.stack-posters { position: absolute; right: -12px; bottom: -15px; width: 176px; height: 132px; }
.stack-posters span {
  position: absolute;
  width: 74px;
  aspect-ratio: 2/3;
  border-radius: 6px;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  background-size: cover;
  background-position: center;
  transform: rotate(var(--r));
  left: var(--x);
  top: var(--y);
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}

/* ---------- календарь ---------- */
.calendar-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; }
.calendar-side { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; align-self: start; position: sticky; top: 88px; }
.calendar-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.calendar-side-head strong { font-size: 15px; text-transform: capitalize; }
.mini-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 14px; }
.mini-calendar .dow {
  display: grid; place-items: center; height: 26px;
  font-size: 11px; color: var(--soft); font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
/* Ячейки — ссылки, а у строчных элементов aspect-ratio не работает:
   раньше из-за этого выбранный день растягивался в вертикальный овал. */
.day-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  position: relative;
  transition: background var(--trans), color var(--trans);
}
.day-cell:hover { background: var(--surface-2); color: var(--text); }
.day-cell.other { opacity: .3; pointer-events: none; }
.day-cell.today { background: var(--surface-2); color: var(--text); font-weight: 900; }
.day-cell.active { background: var(--accent); color: var(--on-accent); font-weight: 900; }
/* точку-метку рисуем поверх, чтобы она не сдвигала цифру вверх */
.day-cell.has-release::after {
  content: ""; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent-2);
}
.day-cell.active.has-release::after { background: var(--on-accent); }

.calendar-reminders { margin-top: 20px; display: grid; gap: 6px; justify-items: start; }
.calendar-reminders small { color: var(--soft); }
.calendar-reminders .metric-value { font-size: 30px; line-height: 1; margin: 2px 0 8px; }
.schedule-list { display: grid; gap: 10px; }
.schedule-card { padding: 12px; display: grid; grid-template-columns: 58px 58px minmax(0, 1fr) auto; align-items: center; gap: 12px; cursor: pointer; transition: background var(--trans); }
.schedule-card:hover { background: var(--surface-2); }
.schedule-time { font-size: 18px; font-weight: 900; letter-spacing: -.03em; }
.schedule-time small { display: block; font-size: 11px; color: var(--soft); font-weight: 700; letter-spacing: 0; }
.schedule-thumb { aspect-ratio: 1; border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.schedule-thumb img { width: 100%; height: 100%; object-fit: cover; }
.schedule-copy h3 { margin: 0 0 3px; font-size: 15px; }
.schedule-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.reminder-btn { width: 38px; height: 38px; border: 0; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.reminder-btn svg { width: 17px; height: 17px; }
.reminder-btn.active { background: var(--accent); color: var(--on-accent); }
.day-group-title { margin: 22px 0 10px; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); }
.day-group-title:first-child { margin-top: 0; }

/* ---------- рейтинги ---------- */
.rank-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 12px; }
.rank-list { display: grid; gap: 7px; }
.rank-card { display: grid; grid-template-columns: 42px 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; border: 0; text-align: left; color: inherit; font-family: inherit; transition: background var(--trans); }
.rank-card:hover { background: var(--surface-2); }
.rank-number { font-size: 22px; font-weight: 900; color: var(--soft); letter-spacing: -.05em; }
.rank-number.top { color: var(--accent); }
.rank-thumb { aspect-ratio: 1; border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-card h3 { margin: 0 0 3px; font-size: 15px; }
.rank-card p { margin: 0; color: var(--muted); font-size: 12px; }
.rank-score { font-size: 20px; font-weight: 900; letter-spacing: -.04em; }

/* ---------- метрики и аналитика ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { padding: 18px; }
.metric-card small { color: var(--muted); }
.metric-value { font-size: clamp(26px, 4vw, 42px); font-weight: 900; letter-spacing: -.06em; margin: 7px 0; }
.metric-delta { font-size: 12px; color: var(--success); font-weight: 800; }
.analytics-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 12px; margin-top: 12px; }
.analytics-card { padding: 18px; min-height: 300px; }
.analytics-card h3 { margin: 0 0 6px; font-size: 18px; }
.chart { width: 100%; height: 220px; margin-top: 16px; }
.donut-wrap { display: grid; place-items: center; min-height: 230px; position: relative; }
.donut { width: 180px; height: 180px; border-radius: 50%; position: relative; background: var(--surface-3); }
.donut::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: var(--surface); }
.donut-copy { position: absolute; text-align: center; z-index: 2; }
.donut-copy strong { display: block; font-size: 27px; letter-spacing: -.04em; }
.legend { display: grid; gap: 8px; }
.legend-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); align-items: center; }
.legend-row strong { color: var(--text); }
.legend-key { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; height: 190px; margin-top: 18px; }
.bars div { border-radius: 4px 4px 2px 2px; background: var(--surface-3); min-height: 3px; }
.bars div.hot { background: var(--accent); }

/* ---------- библиотека ---------- */
.library-list { display: grid; gap: 10px; margin-top: 14px; }
.library-item { background: var(--surface); border-radius: var(--radius); padding: 11px; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 13px; align-items: center; }
.library-item .poster { aspect-ratio: 2/3; cursor: pointer; }
.library-copy h3 { margin: 0 0 5px; font-size: 15px; }
.library-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.library-copy .line-progress { margin-top: 10px; max-width: 520px; }
.library-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- профиль ---------- */
.profile-hero { background: var(--surface); border-radius: var(--radius); padding: 22px; display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.profile-hero .avatar { width: 86px; height: 86px; font-size: 28px; border-radius: var(--radius-lg); }
.profile-hero h1 { margin: 0 0 5px; font-size: 30px; letter-spacing: -.04em; }
.profile-hero p { margin: 0 0 10px; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.profile-card { padding: 18px; }
.achievement-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.achievement { background: var(--surface-2); border-radius: var(--radius); padding: 12px; text-align: center; }
.achievement svg { margin: 0 auto 8px; width: 28px; height: 28px; color: var(--accent); }
.achievement small { display: block; color: var(--muted); }
.achievement.locked { opacity: .38; }
.achievement.locked svg { color: var(--soft); }

/* ---------- страница дорамы ---------- */
.detail-page { padding-top: 0; }
.detail-hero {
  min-height: 540px;
  margin: 0 -24px 22px;
  padding: 110px 24px 32px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: end;
  background: linear-gradient(145deg, #262624, #151513 68%);
}
.detail-hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 20%; }
.detail-hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 90%, transparent) 46%, color-mix(in srgb, var(--bg) 22%, transparent) 100%),
    linear-gradient(to top, var(--bg) 2%, transparent 60%);
}
.detail-main { position: relative; z-index: 2; max-width: 780px; }
.detail-main h1 { margin: 12px 0 6px; font-size: clamp(38px, 6vw, 74px); line-height: .92; letter-spacing: -.065em; }
.detail-original { color: var(--soft); font-weight: 700; margin: 0 0 12px; }
.detail-main p { color: #c8c4ba; max-width: 720px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
.detail-card { padding: 18px; }
.detail-card h2, .detail-card h3 { margin-top: 0; }
.detail-card h2 { font-size: 20px; letter-spacing: -.03em; }
.detail-card h3 { font-size: 16px; }
.facts-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.fact { background: var(--surface-2); border-radius: var(--radius); padding: 12px; min-width: 0; }
.fact small { display: block; color: var(--muted); }
.fact strong { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; }
.season-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.season-tabs::-webkit-scrollbar { display: none; }
.episode-list { display: grid; gap: 7px; max-height: 620px; overflow-y: auto; padding-right: 4px; }
.episode {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: 42px 104px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: background var(--trans);
}
.episode:hover { background: var(--surface-3); }
.episode.locked { cursor: default; opacity: .72; }
.episode.watched .episode-number { color: var(--accent); }
.episode-number { font-size: 18px; font-weight: 900; color: var(--soft); text-align: center; letter-spacing: -.04em; }
.episode-thumb { aspect-ratio: 16/9; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode h4 { margin: 0 0 3px; font-size: 14px; }
.episode p { margin: 0; color: var(--muted); font-size: 12px; }
.episode-action { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 6px; width: 38px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.episode.locked .episode-action { background: var(--surface-3); color: var(--soft); }
.cast-list { display: grid; gap: 8px; }
.cast-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
.cast-photo { width: 44px; height: 44px; border-radius: var(--radius); background: linear-gradient(145deg, var(--accent-3), #30294f); overflow: hidden; display: grid; place-items: center; font-weight: 900; color: #fff; }
.cast-photo img { width: 100%; height: 100%; object-fit: cover; }
.cast-row strong { display: block; font-size: 13px; }
.cast-row small { color: var(--muted); }
.review { background: var(--surface-2); border-radius: var(--radius); padding: 12px; margin-top: 8px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-head strong { font-size: 13px; }
.review p { color: var(--muted); margin: 8px 0 0; }
.review-date { color: var(--soft); font-size: 12px; }

/* плеер */
.player-card { padding: 0; overflow: hidden; background: #000; border-radius: var(--radius); margin-bottom: 12px; }
.player-frame { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--surface); }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); flex-wrap: wrap; }
.player-bar strong { font-size: 14px; }
.player-bar .grow { min-width: 120px; }

/* ---------- поиск ---------- */
.search-panel { width: min(860px, 100%); background: var(--surface); border-radius: var(--radius-lg); margin-top: 5vh; overflow: hidden; box-shadow: var(--shadow-2); }
.search-input-wrap { display: flex; align-items: center; gap: 10px; padding: 16px; background: var(--surface-2); }
.search-input-wrap svg { width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto; }
.search-input-wrap input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 18px; }
.search-results { max-height: 68vh; overflow: auto; padding: 12px; }
.search-section-label { padding: 10px 10px 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--soft); font-weight: 800; }
.search-result { padding: 10px; border-radius: var(--radius); display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; cursor: pointer; border: 0; background: transparent; text-align: left; color: inherit; width: 100%; font-family: inherit; }
.search-result:hover, .search-result.cursor { background: var(--surface-2); }
.search-result .poster { aspect-ratio: 2/3; }
.search-result h4 { margin: 0 0 3px; font-size: 14px; }
.search-result p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- авторизация ---------- */
.auth-modal { width: min(460px, 100%); }
.form-grid { display: grid; gap: 9px; }
.form-note { color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- нижняя навигация ---------- */
.bottom-nav { display: none; }
.mobile-only { display: none; }

/* ============================================================
   Адаптив
   Шесть ступеней вместо трёх: сетка, шапка и внутренние блоки
   перестраиваются плавно, без «прыжка» с десктопа сразу в телефон.
   ============================================================ */

/* --- широкие экраны --- */
@media (min-width: 1700px) {
  .drama-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

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

@media (max-width: 1240px) {
  .drama-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .rank-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1180px) {
  :root { --sidebar: 200px; }
  .drama-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .collections-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .continue-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .feature-card:first-child { grid-column: 1 / -1; }
}

/* --- планшет: боковое меню уезжает, появляется нижняя панель --- */
@media (max-width: 980px) {
  :root { --sidebar: 0px; }

  .sidebar { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }

  .topbar {
    height: auto;
    min-height: 60px;
    padding: 8px 14px;
    gap: 8px;
  }
  .topbar-brand { display: flex; }
  .topbar-title { display: none; }

  .search-button {
    min-width: 0;
    max-width: none;
    width: 42px;
    flex: 0 0 42px;
    padding: 0;
    justify-content: center;
    min-height: 40px;
  }
  .search-button .search-hint, .search-button kbd { display: none; }

  .top-actions { gap: 6px; }
  .top-actions .icon-button { width: 40px; height: 40px; }
  .top-actions .top-auth { min-height: 40px; padding: 0 13px; font-size: 13px; display: inline-flex; align-items: center; }

  .page { padding: 8px 14px 104px; }
  .page-head { margin: 14px 0 18px; }

  .detail-hero { margin: 0 -14px 18px; padding-left: 14px; padding-right: 14px; }
  .drama-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card:first-child { grid-column: auto; }
  .calendar-layout, .rank-layout, .analytics-grid, .detail-grid, .profile-grid { grid-template-columns: 1fr; }
  .calendar-side { position: static; }
  .collections-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .continue-grid { grid-template-columns: 1fr; }
  .facts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .episode-list { max-height: none; }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 120;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(18px);
    padding: 6px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
  }
  .bottom-nav a, .bottom-nav button {
    border: 0; background: transparent; color: var(--soft);
    padding: 7px 3px; border-radius: var(--radius);
    display: grid; gap: 2px; place-items: center;
    font-size: 10px; font-family: inherit; cursor: pointer;
    min-width: 0; text-align: center;
  }
  .bottom-nav a svg, .bottom-nav button svg { width: 18px; height: 18px; }
  .bottom-nav a.active, .bottom-nav button.active { background: var(--accent); color: var(--on-accent); font-weight: 900; }

  .mobile-only { display: block; }
  .hero-dots { right: 16px; bottom: 16px; }
}

/* --- телефон --- */
@media (max-width: 680px) {
  .hero { min-height: 440px; padding: 24px 16px; }
  .hero h1 { font-size: clamp(30px, 9vw, 44px); }
  .hero p { font-size: 14px; -webkit-line-clamp: 3; }
  .hero-veil { background: linear-gradient(to top, rgba(16,16,15,.97) 12%, rgba(16,16,15,.62) 60%, rgba(16,16,15,.32)); }
  .hero-content { margin-top: 90px; }
  .hero-symbol { font-size: clamp(90px, 30vw, 150px); right: 2%; }
  .hero-actions { width: 100%; }
  .hero-actions .primary-button, .hero-actions .ghost-button { flex: 1 1 auto; justify-content: center; }

  .page-head { align-items: start; flex-direction: column; gap: 10px; }
  .page-head h1 { font-size: clamp(26px, 8vw, 34px); }
  .section { margin-top: 26px; }
  .section-head { flex-wrap: wrap; gap: 8px; }
  .section-head h2 { font-size: clamp(19px, 5.5vw, 24px); }

  .drama-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  /* на узком экране строка «страна · год · серии» переносится,
     а не обрезается — так ничего не теряется и ничего не наезжает */
  .card-meta { flex-wrap: wrap; white-space: normal; row-gap: 2px; }
  .card-meta span, .card-meta span + span { flex: 0 0 auto; }

  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel > *:first-child { grid-column: 1 / -1; }
  .collections-grid { grid-template-columns: 1fr; }
  .collection-card { min-height: 190px; }
  .collection-card h3, .collection-card p { max-width: min(100%, 60vw); }

  .schedule-card { grid-template-columns: 50px 48px minmax(0, 1fr) auto; gap: 8px; }
  .schedule-time { font-size: 15px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 14px; }
  .rank-card { grid-template-columns: 32px 46px minmax(0, 1fr) auto; gap: 9px; padding: 9px 10px; }

  .profile-hero { grid-template-columns: 70px minmax(0, 1fr); padding: 16px; }
  .profile-hero .avatar { width: 70px; height: 70px; font-size: 24px; }
  .profile-hero > .primary-button { grid-column: 1 / -1; }
  .achievement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts-grid { grid-template-columns: 1fr 1fr; }

  .detail-hero { min-height: 480px; padding-top: 74px; padding-bottom: 24px; }
  .detail-main h1 { font-size: clamp(28px, 8.5vw, 40px); }
  .detail-main p { font-size: 14px; }
  .detail-card { padding: 14px; }

  .episode { grid-template-columns: 34px 78px minmax(0, 1fr); }
  .episode-action { display: none; }
  .library-item { grid-template-columns: 64px minmax(0, 1fr); }
  .library-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .continue-card { grid-template-columns: 92px minmax(0, 1fr); }

  .player-bar { padding: 10px 12px; }
  .player-bar .grow { min-width: 0; }

  .overlay { padding: 12px; }
  .search-panel { margin-top: 0; }
  .search-input-wrap { padding: 12px; }
  .search-input-wrap input { font-size: 16px; }
  .search-results { max-height: 62vh; }
}

/* --- узкие телефоны --- */
@media (max-width: 420px) {
  .page { padding: 6px 10px 104px; }
  .detail-hero { margin: 0 -10px 16px; padding-left: 10px; padding-right: 10px; }
  .topbar { padding: 8px 10px; }
  .topbar-brand span { display: none; }
  .drama-grid { gap: 12px 8px; }
  .metric-grid, .achievement-grid, .facts-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .schedule-card { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .schedule-thumb { display: none; }
  .hero-meta .pill { font-size: 11px; }
  .bottom-nav { left: 6px; right: 6px; }
}

/* На телефонах ховер-эффектов нет — убираем «залипшие» состояния */
@media (hover: none) {
  .drama-card:hover .poster { transform: none; box-shadow: none; filter: none; }
  .poster-play { display: none; }
  .hero:hover .hero-bg { transform: scale(1.03); }
  /* без наведения стрелки иначе не показать */
  .hero-nav { opacity: 1; width: 38px; height: 38px; }
  .hero-nav.prev { left: 10px; }
  .hero-nav.next { right: 10px; }
}

/* ============================================================
   Рекламные блоки
   Отступ висит на самом блоке, а не на обёртке: пока рекламы нет,
   место не занимается и ритм страницы не рвётся.
   ============================================================ */
.ad-slot,
.player-ad {
  display: block;
  width: 100%;
}

.ad-slot > div,
.player-ad > div {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 18px;
}

.ad-slot > div:empty,
.player-ad > div:empty {
  display: none;
  margin: 0;
}

.player-ad.above > div { margin-bottom: 12px; }
.player-ad.below > div { margin: 12px auto 18px; }

.ad-slot iframe,
.player-ad iframe,
.ad-slot video,
.player-ad video {
  max-width: 100%;
  border: 0;
  border-radius: var(--radius);
  display: block;
}

#doraeAdHolder { display: none !important; }

@media (max-width: 620px) {
  .ad-slot > div,
  .player-ad > div { margin-bottom: 14px; }
}

/* ============================================================
   Уведомления
   ============================================================ */
.notify-list { display: grid; gap: 6px; max-height: 62vh; overflow-y: auto; }

.notify-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}

.notify-row:hover { background: var(--surface-3); transform: translateX(2px); }

.notify-row > img,
.notify-row > .ph {
  width: 44px;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--soft);
}

.notify-text { min-width: 0; }
.notify-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.notify-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notify-meta { display: grid; gap: 4px; justify-items: end; text-align: right; }
.notify-meta small { color: var(--soft); font-size: 11px; white-space: nowrap; }

@media (max-width: 620px) {
  .notify-row { grid-template-columns: 40px 1fr; }
  .notify-meta { grid-column: 2; justify-items: start; text-align: left; }
  .notify-meta { display: flex; align-items: center; gap: 8px; }
}

/* ------------------------------------------------------------
   Серверная версия: хлебные крошки, вопросы и постраничная навигация.
   Стилистика та же, что у остальных блоков.
   ------------------------------------------------------------ */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs b { color: var(--text); font-weight: 600; }

.faq-item { padding: 12px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; float: right; color: var(--soft); font-weight: 400; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin: 10px 0 0; line-height: 1.7; font-size: 14px; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 26px 0 8px; }
.page-num {
  min-width: 42px; padding: 10px 12px; text-align: center; border-radius: var(--radius);
  background: var(--surface); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--trans), color var(--trans), transform var(--trans);
}
.page-num:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }
.page-num.active { background: var(--accent); color: var(--on-accent); font-weight: 900; }
.page-num.nav { font-size: 18px; line-height: 1; padding-bottom: 12px; }
.page-gap { color: var(--soft); padding: 0 2px; user-select: none; }
.pagination-note { text-align: center; color: var(--soft); font-size: 12px; margin: 0 0 8px; }

@media (max-width: 420px) {
  .page-num { min-width: 38px; padding: 9px 9px; font-size: 13px; }
}

/* ============================================================
   Блок «Выберите настроение» и форма отзыва
   ============================================================ */
.mood-chip {
  border: 0;
  border-radius: var(--radius);
  padding: 9px 13px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  flex: 0 0 auto;
  cursor: pointer;
  transition: background var(--trans), color var(--trans), transform var(--trans);
}
.mood-chip:hover { background: var(--surface-2); color: var(--text); transform: translateY(-1px); }
.mood-chip.active { background: var(--accent); color: var(--on-accent); }

#moodGrid { transition: opacity 140ms ease; }

/* оценка в отзыве: десять клавиш вместо непонятных звёзд */
.rate-row { display: flex; flex-wrap: wrap; gap: 5px; }
.rate-star {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--soft);
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--trans), color var(--trans), transform var(--trans);
}
.rate-star:hover { transform: translateY(-1px); color: var(--text); }
.rate-star.on { background: var(--accent); color: var(--on-accent); }

.review[data-mine] { box-shadow: inset 0 0 0 1px var(--accent-line); }

@media (max-width: 420px) {
  .rate-star { width: 32px; height: 32px; font-size: 13px; }
}

/* ============================================================
   Счётчик непрочитанных оповещений
   ============================================================ */
#notificationBtn { position: relative; }
.notify-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #1a0e0f;
  font-size: 10px;
  font-weight: 900;
  line-height: 17px;
  text-align: center;
  pointer-events: none;
}
/* непрочитанная строка помечается точкой слева */
.notify-row.is-new { background: var(--surface-3); }
.notify-row.is-new .notify-text strong::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
  vertical-align: middle;
}
