/* Хаб. Без grid, flex-gap, aspect-ratio и :has — ради старых ТВ-браузеров. */
:root {
  --bg: #0d0e12;
  --surface: #15171d;
  --surface-2: #1c1f27;
  --line: #262a34;
  --text: #eceef3;
  --muted: #8a90a0;
  --accent: #ff7a45;
  --accent-2: #ffb15c;
  --c-audio: #e8622a;  /* статистика: аудио и видео (проверены на различимость при дальтонизме) */
  --c-video: #0000ff;
  --c-book: #279f7b;  /* чтение — отдельно от прослушанного */
  --danger: #ff5a6e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (min-width: 1600px) { html { font-size: 19px; } }
@media (min-width: 2400px) { html { font-size: 26px; } }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 15% -10%, rgba(255, 122, 69, .10), transparent 60%),
                    radial-gradient(900px 400px at 100% 0%, rgba(110, 120, 255, .07), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 400 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
p a, .muted a, .empty a { color: var(--accent-2); }
h1, h2 { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; margin-bottom: .9rem; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.mt { margin-top: 2rem; }
.pad { padding: 1rem 0; }
.inline { display: inline-block; margin: 0; }

/* Фокус для пульта и клавиатуры */
a:focus, button:focus, input:focus, textarea:focus, audio:focus, video:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }
/* Системная подсветка тапа (синий прямоугольник на Android) не нужна — у кнопок своя реакция на нажатие. */
html { -webkit-tap-highlight-color: transparent; }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }
@media (min-width: 1600px) { .wrap { max-width: 92vw; padding: 0 3vw; } }

/* Шапка */
.top {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 10;
  /* Сплошной фон, не полупрозрачный: иначе iPadOS 26+ в приложении с экрана «Домой» кладёт поверх верха страницы
     размытое «стекло». Сплошную закреплённую полосу во всю ширину система не размывает, а продлевает её цвет. */
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.top__in { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.top__actions { white-space: nowrap; }
.top__actions > * { margin-left: .5rem; }
.top__actions { display: flex; align-items: center; }
.top .btn--icon { color: #c9cdd8; padding: .5rem; }
.top .btn--icon:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.top .ico { width: 1.5rem; height: 1.5rem; }
@media (max-width: 480px) {
  .top__actions > * { margin-left: 0; }
  .top__actions .btn { padding: .65rem .55rem; }
  .top__actions .btn--icon { padding: .5rem; }
}
.logo { display: inline-flex; align-items: center; font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.logo__mark {
  display: inline-block; width: 2rem; height: 2rem; line-height: 2rem; text-align: center;
  border-radius: 9px; margin-right: .6rem; color: var(--bg); font-size: 1.05rem;
  background: var(--accent); background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px rgba(255, 122, 69, .35);
}
.logo__img { display: block; height: 1.9rem; width: auto; }
.logo--big { display: block; margin-bottom: .8rem; }
.logo--big .logo__img { height: 3.4rem; margin: 0 auto; }
.logo--big .logo__mark { width: 2.8rem; height: 2.8rem; line-height: 2.8rem; font-size: 1.4rem; border-radius: 12px; }

.main { padding-top: 1.5rem; padding-bottom: 4rem; }

/* Хлебные крошки */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--text); }
.crumbs__sep { margin: 0 .5rem; opacity: .5; }

.hero-title { margin: .5rem 0 1.8rem; }
.hero-title h1 { font-size: 2.2rem; }
@media (min-width: 900px) { .hero-title h1 { font-size: 2.8rem; } }
.hero-title p { margin: .4rem 0 0; }
.lead { color: #c4c8d3; font-size: 1.05rem; max-width: 46rem; margin: .6rem 0 0; white-space: pre-line; }
.eyebrow { display: inline-block; color: var(--accent-2); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem; }

/* Атрибут hidden прячет всегда: иначе display у .btn и других классов перебивает его и «скрытые» кнопки видны */
[hidden] { display: none !important; }

/* Кнопки */
.btn {
  display: inline-block; vertical-align: middle; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; line-height: 1.2;
  padding: .65rem 1.1rem; border-radius: 10px; cursor: pointer; text-align: center;
  -webkit-transition: background .15s, border-color .15s, -webkit-transform .15s; transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: #252935; border-color: #333846; color: #fff; }
.btn:active { -webkit-transform: translateY(1px); transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #1a0d06; }
.btn--primary:hover { background: #ff8b5c; border-color: #ff8b5c; color: #1a0d06; }
.btn--ghost { background: transparent; border-color: transparent; color: #c9cdd8; }
.btn--ghost:hover { background: rgba(255, 255, 255, .06); border-color: transparent; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: rgba(255, 90, 110, .12); border-color: rgba(255, 90, 110, .3); color: var(--danger); }
.btn--sm { padding: .45rem .8rem; font-size: .85rem; }
.btn--icon { padding: .4rem .6rem; min-width: 2.2rem; background: transparent; border-color: transparent; color: var(--muted); }
.btn--icon:hover { color: var(--text); }
.btn--block { display: block; width: 100%; }

/* Сетка карточек: flex + отрицательные поля */
.grid { display: flex; flex-wrap: wrap; margin: -8px; }
.grid > .card { width: calc(50% - 16px); margin: 8px; }
@media (min-width: 640px) { .grid > .card { width: calc(33.333% - 16px); } }
@media (min-width: 960px) { .grid > .card { width: calc(25% - 16px); } }
@media (min-width: 1280px) { .grid > .card { width: calc(20% - 16px); } }
@media (min-width: 1900px) { .grid > .card { width: calc(16.666% - 16px); } }
.grid--wide > .card { width: calc(100% - 16px); }
@media (min-width: 560px) { .grid--wide > .card { width: calc(50% - 16px); } }
@media (min-width: 1100px) { .grid--wide > .card { width: calc(33.333% - 16px); } }
@media (min-width: 1900px) { .grid--wide > .card { width: calc(25% - 16px); } }

.card {
  display: block; position: relative; border-radius: var(--radius); background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .04); overflow: hidden;
  -webkit-transition: -webkit-transform .2s, box-shadow .2s, border-color .2s; transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover, .card:focus {
  -webkit-transform: translateY(-4px) scale(1.02); transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow); border-color: rgba(255, 255, 255, .1); color: inherit;
}
.card:focus { outline: 3px solid var(--accent); outline-offset: 2px; z-index: 1; }
.card__body { display: block; padding: .8rem 1rem 1rem; }
.card__title { display: block; font-weight: 700; font-size: 1.02rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__meta { display: block; color: var(--muted); font-size: .85rem; margin-top: .2rem; }

/* Обложки: пропорции через padding-хак */
.cover { position: relative; overflow: hidden; background: var(--surface-2); }
.cover::before { content: ""; display: block; padding-top: 100%; }
.cover--wide::before { padding-top: 52%; }
.cover img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.cover--empty span {
  position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
  font-size: 3rem; font-weight: 800; color: rgba(255, 255, 255, .85); text-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}
.cover--wide.cover--empty span { font-size: 3.6rem; }

/* Пустые состояния */
.empty { text-align: center; padding: 4rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty__title { font-size: 1.2rem; font-weight: 700; margin: 0 0 .4rem; }
.empty__hint { color: var(--muted); margin: 0; }

/* Страница раздела */
.unit-head { display: flex; flex-direction: column; margin-bottom: 1.8rem; }
.unit-head__cover { width: 60%; max-width: 280px; margin-bottom: 1.2rem; }
.unit-head__cover .cover { border-radius: var(--radius); box-shadow: var(--shadow); }
.unit-head__info h1 { font-size: 2rem; }
.unit-head__info p { margin: .5rem 0 0; }
@media (min-width: 700px) {
  .unit-head { flex-direction: row; align-items: flex-end; }
  .unit-head__cover { width: 240px; margin: 0 2rem 0 0; -webkit-flex-shrink: 0; flex-shrink: 0; }
  .unit-head__info h1 { font-size: 2.8rem; }
}
@media (min-width: 1600px) { .unit-head__cover { width: 300px; } }

.player {
  position: relative;
  background: #1c1f27;
  border: 1px solid rgba(255, 255, 255, .06); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-bottom: 1.5rem;
}
.player__now { display: flex; align-items: baseline; margin-bottom: .7rem; min-width: 0; }
.player__label { color: var(--accent); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin-right: .7rem; -webkit-flex-shrink: 0; flex-shrink: 0; }
.player__title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player__audio { display: block; width: 100%; height: 3rem; }
.player__video { display: block; width: 100%; max-height: 78vh; background: #000; border-radius: 10px; }
.player__bar { display: flex; justify-content: space-between; -webkit-align-items: center; align-items: center; margin-top: .6rem; }
.player__bar .btn { -webkit-flex: 1; flex: 1; }
.player__bar .btn + .btn { margin-left: .4rem; }
@media (min-width: 700px) { .player__bar { justify-content: flex-start; } .player__bar .btn { -webkit-flex: none; flex: none; } }

.tracks { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.track {
  display: flex; align-items: center; position: relative; padding: .85rem 1rem; border-radius: 12px; overflow: hidden;
  -webkit-transition: background .15s; transition: background .15s;
}
.track:hover, .track:focus { background: var(--surface); }
.track:focus { outline-offset: -3px; }
.track.is-current { background: var(--surface-2); }
.track.is-current .track__n { color: var(--accent); }
.track.is-current .track__title { color: #fff; }
.track__n { width: 2.2rem; -webkit-flex-shrink: 0; flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.track__title { -webkit-flex: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.track__dur { margin-left: 1rem; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.track__progress { position: absolute; left: 1rem; right: 1rem; bottom: .35rem; height: 2px; }
.track__progress span { display: block; height: 100%; width: 0; background: var(--accent); opacity: .7; border-radius: 2px; }
.track.is-done .track__title { color: var(--muted); }
.track.is-done .track__n::after { content: " ✓"; color: var(--accent-2); }
.tag { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .15rem .45rem; border-radius: 6px; background: rgba(255, 177, 92, .14); color: var(--accent-2); vertical-align: middle; margin-left: .4rem; }

/* Формы */
.form .field { display: block; margin-bottom: 1rem; }
.field span { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: .35rem; }
.field small, .cover-edit small { display: block; color: var(--muted); font-size: .78rem; margin-top: .35rem; }
input[type=text], input[type=password], input:not([type]), textarea {
  display: block; width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem;
}
input:focus, textarea:focus { border-color: var(--accent); outline-offset: 0; outline-width: 2px; }
textarea { resize: vertical; }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }
.form--row { display: flex; flex-wrap: wrap; align-items: center; }
.form--row > * { margin: 0 .6rem .6rem 0; }
.alert { background: rgba(255, 90, 110, .12); border: 1px solid rgba(255, 90, 110, .3); color: #ffb3bd; padding: .7rem .9rem; border-radius: 10px; margin: 0 0 1rem; }

/* Вход */
.login { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login__card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid rgba(255, 255, 255, .05); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow); text-align: center; }
.login__card .form { text-align: left; margin-top: 1.5rem; }

/* Ошибки и подтверждения */
.error-page { text-align: center; padding: 5rem 1rem; }
.error-page__code { font-size: 5rem; font-weight: 800; margin: 0; color: var(--accent); line-height: 1; }
.error-page h1 { margin: 1rem 0 1.5rem; font-size: 1.6rem; }
.error-page .btn { margin: .3rem; }

/* Админка */
.admin-cols { display: flex; flex-direction: column; }
.panel { background: var(--surface); border: 1px solid rgba(255, 255, 255, .04); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.2rem; min-width: 0; }
@media (min-width: 1000px) {
  .admin-cols { flex-direction: row; align-items: flex-start; }
  .panel { -webkit-flex: 1; flex: 1; margin: 0 1.2rem 0 0; padding: 1.5rem; }
  .panel--side { -webkit-flex: none; flex: none; width: 360px; margin-right: 0; position: -webkit-sticky; position: sticky; top: 5rem; }
}
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row__main { display: flex; align-items: center; -webkit-flex: 1; flex: 1; min-width: 0; padding: .2rem; border-radius: 10px; }
.row__main:hover { background: rgba(255, 255, 255, .03); }
.row__thumb { width: 3rem; -webkit-flex-shrink: 0; flex-shrink: 0; margin-right: .9rem; }
.row__thumb .cover { border-radius: 8px; }
.row__thumb .cover--empty span { font-size: 1.2rem; }
.row__title { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { display: block; color: var(--muted); font-size: .82rem; }
.row__meta--fixed { -webkit-flex-shrink: 0; flex-shrink: 0; margin: 0 .5rem; white-space: nowrap; }
.row__kind { width: 2rem; -webkit-flex-shrink: 0; flex-shrink: 0; text-align: center; color: var(--accent-2); }
.row__rename { display: flex; align-items: center; -webkit-flex: 1; flex: 1; min-width: 0; }
.row__rename input { padding: .45rem .6rem; background: transparent; border-color: transparent; }
.row__rename input:hover { border-color: var(--line); }
.row__rename input:focus { background: var(--bg); }
.row__rename .btn { margin-left: .3rem; visibility: hidden; }
.row__rename.is-dirty .btn, .row__rename input:focus + .btn { visibility: visible; }
.move { white-space: nowrap; }
@media (max-width: 640px) {
  .row--media { flex-wrap: wrap; }
  .row--media .row__rename { width: calc(100% - 2rem); -webkit-flex: none; flex: none; }
  .row--media .row__meta--fixed { -webkit-flex: 1; flex: 1; margin-left: 2rem; }
}

.cover-edit { display: flex; align-items: flex-start; }
.cover-edit__img { width: 5.5rem; -webkit-flex-shrink: 0; flex-shrink: 0; margin-right: 1rem; }
.cover-edit__img .cover { border-radius: 10px; }
.cover-edit__forms { min-width: 0; }

/* Зона загрузки */
.drop {
  position: relative; display: block; border: 2px dashed #343947; border-radius: var(--radius);
  padding: 2rem 1rem; text-align: center; margin-bottom: 1rem; background: rgba(255, 255, 255, .015);
  -webkit-transition: border-color .15s, background .15s; transition: border-color .15s, background .15s;
}
.drop.is-over { border-color: var(--accent); background: rgba(255, 122, 69, .06); }
.drop input[type=file] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop__text strong { display: block; font-size: 1.05rem; margin-bottom: .3rem; }
.drop__text span { font-size: .88rem; }
.drop noscript .btn { position: relative; z-index: 1; margin-top: 1rem; }
.no-js-upload input[type=file] { position: static; opacity: 1; }

.uploads { list-style: none; margin: 0 0 1rem; padding: 0; }
.upload { padding: .6rem .8rem; background: var(--surface-2); border-radius: 10px; margin-bottom: .4rem; font-size: .9rem; }
.upload__top { display: flex; justify-content: space-between; }
.upload__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 1rem; }
.upload__pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.upload__bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: .45rem; overflow: hidden; }
.upload__bar span { display: block; height: 100%; width: 0; background: var(--accent); background: linear-gradient(90deg, var(--accent-2), var(--accent)); -webkit-transition: width .2s; transition: width .2s; }
.upload.is-error { color: #ffb3bd; }
.upload.is-error .upload__bar span { background: var(--danger); width: 100%; }
.upload.is-done .upload__pct { color: var(--accent-2); }

/* Кнопка выбора файла в общем стиле */
input[type=file]::-webkit-file-upload-button {
  font: inherit; font-weight: 600; font-size: .85rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .8rem; margin-right: .6rem; cursor: pointer;
}
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: .85rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .8rem; margin-right: .6rem; cursor: pointer;
}
.cover-edit input[type=file] { width: 100%; font-size: .82rem; }

/* Текст только для экранных читалок */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Дата и описание выпуска */
.player__info { margin-top: .8rem; }
.player__info[hidden], .player__info [hidden] { display: none; }
.player__date { margin: 0 0 .35rem; color: var(--accent-2); font-size: .85rem; font-weight: 600; }
.player__desc {
  color: #c4c8d3; font-size: .95rem; line-height: 1.55; white-space: pre-line; max-width: 60rem;
}
.track__main { display: block; -webkit-flex: 1; flex: 1; min-width: 0; }
.track__main .track__title { display: block; }
.track__date { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }

/* Большая кнопка запуска */
.player__row { display: flex; align-items: center; }
.player__row .player__audio { -webkit-flex: 1; flex: 1; min-width: 0; }
.play-big {
  -webkit-flex-shrink: 0; flex-shrink: 0; width: 4.5rem; height: 4.5rem; margin-right: 1rem; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; color: #1a0d06;
  background: var(--accent); background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 24px rgba(255, 122, 69, .35);
  -webkit-transition: -webkit-transform .15s, box-shadow .15s; transition: transform .15s, box-shadow .15s;
}
.play-big[hidden] { display: none; }
.play-big:hover { -webkit-transform: scale(1.06); transform: scale(1.06); box-shadow: 0 10px 30px rgba(255, 122, 69, .5); }
.play-big:active { -webkit-transform: scale(.96); transform: scale(.96); }
/* На сенсорных экранах наведение «залипает» после тапа — увеличение и свечение только для мыши. */
@media (hover: none) { .play-big:hover { -webkit-transform: none; transform: none; box-shadow: 0 8px 24px rgba(255, 122, 69, .35); } }
.play-big:focus { outline: 3px solid #fff; outline-offset: 4px; }
.play-big svg { display: block; width: 46%; height: 46%; margin: 0 auto; fill: currentColor; }
.play-big__pause, .play-big.is-playing .play-big__play { display: none !important; }
.play-big.is-playing .play-big__pause { display: block !important; }
.player__desc a { color: var(--accent-2); word-break: break-all; }
.player__desc .timecode {
  display: inline-block; padding: .05rem .4rem; margin: .1rem 0; border-radius: 6px; word-break: normal;
  background: rgba(255, 177, 92, .12); font-variant-numeric: tabular-nums; font-weight: 600;
}
.player__desc .timecode:hover, .player__desc .timecode:focus { background: rgba(255, 177, 92, .25); color: #fff; }

/* Своя полоса перемотки для аудио */
.player__row .player__audio:not([controls]) { display: none; }
.scrub { display: flex; align-items: center; -webkit-flex: 1; flex: 1; min-width: 0; }
.scrub[hidden] { display: none; }
.scrub__time { -webkit-flex-shrink: 0; flex-shrink: 0; min-width: 3.4em; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.scrub__time:last-child { text-align: right; }
.scrub__range {
  -webkit-appearance: none; appearance: none; -webkit-flex: 1; flex: 1; min-width: 0; margin: 0 .9rem;
  height: 6px; border-radius: 3px; background: #2b2f3a; cursor: pointer; padding: 0; border: 0;
}
.scrub__range:focus { outline: 3px solid var(--accent); outline-offset: 6px; }
.scrub__range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.scrub__range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; }
.scrub__range::-moz-range-track { background: transparent; }

/* «Продолжить» на главной */
.recent { margin: .5rem 0 2.2rem; }
.recent h2 { font-size: 1.3rem; }
.recent__list { display: flex; flex-wrap: wrap; margin: -6px; }
.recent__item { position: relative; width: calc(100% - 12px); margin: 6px; }
@media (min-width: 760px) { .recent__item { width: calc(50% - 12px); } }
@media (min-width: 1200px) { .recent__item { width: calc(33.333% - 12px); } }
.recent__card {
  display: flex; align-items: stretch; position: relative; overflow: hidden;
  padding: .7rem 3.6rem .7rem .7rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid rgba(255, 255, 255, .05);
  -webkit-transition: background .15s, border-color .15s; transition: background .15s, border-color .15s;
}
.recent__card:hover { background: var(--surface-2); border-color: rgba(255, 255, 255, .12); }
.recent__play { display: block; position: relative; width: 4.5rem; min-width: 4.5rem; margin-right: .9rem; border-radius: 10px; }
.recent__cover { display: block; border-radius: 10px; overflow: hidden; }
.recent__link { display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0; border-radius: 8px; color: inherit; }
.recent__link:hover, .recent__link:focus { color: inherit; }
.recent__link:hover .recent__title { text-decoration: underline; }
/* Значок на обложке: ▶ — продолжить, ❚❚ — пауза */
.recent__icon {
  position: absolute; left: 50%; top: 50%; width: 2.2rem; height: 2.2rem; margin: -1.1rem 0 0 -1.1rem;
  border-radius: 50%; background: rgba(0, 0, 0, .55); opacity: .85;
  -webkit-transition: opacity .15s, -webkit-transform .15s; transition: opacity .15s, transform .15s;
}
.recent__icon::before {
  content: ""; position: absolute; left: 50%; top: 50%; margin: -.45rem 0 0 -.3rem;
  border-style: solid; border-width: .45rem 0 .45rem .75rem; border-color: transparent transparent transparent #fff;
}
.recent__play:hover .recent__icon, .recent__play:focus .recent__icon { opacity: 1; -webkit-transform: scale(1.1); transform: scale(1.1); }
.recent__play.is-playing .recent__icon { background: var(--accent); opacity: 1; }
.recent__play.is-playing .recent__icon::before {
  width: .22rem; height: .8rem; margin: -.4rem 0 0 -.33rem; border: 0; background: #fff; box-shadow: .44rem 0 0 #fff;
}
.recent__unit { display: block; color: var(--accent-2); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__title { display: block; font-weight: 700; line-height: 1.3; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__meta { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.recent__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .06); }
.recent__progress span { display: block; height: 100%; background: var(--accent); }
.recent__hide { position: absolute; top: 50%; right: .5rem; margin: -1.4rem 0 0; }
.recent__item.is-open .recent__hide { top: 2.95rem; }  /* центр карточки, а не всего блока с описанием */
.recent__more { margin-top: 6px; padding: .9rem 1rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid rgba(255, 255, 255, .05); }
.recent__more[hidden], .recent__more [hidden] { display: none; }
.recent__x {
  display: block; width: 2.8rem; height: 2.8rem; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font: 400 1.7rem/2.8rem Arial, sans-serif; cursor: pointer;
}
.recent__x:hover, .recent__x:focus { background: rgba(255, 255, 255, .08); color: var(--text); }

/* Обновление оттягиванием (режим приложения на iPhone) */
.ptr {
  position: fixed; top: env(safe-area-inset-top, 0); left: 50%; z-index: 100; width: 2.4rem; height: 2.4rem; margin-left: -1.2rem;
  border-radius: 50%; background: var(--surface-2); box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
  opacity: 0; -webkit-transform: translateY(-50px); transform: translateY(-50px); pointer-events: none;
}
.ptr::before {
  content: ""; position: absolute; left: .6rem; top: .6rem; width: 1.2rem; height: 1.2rem; box-sizing: border-box;
  border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%;
}
.ptr.is-ready::before { border-color: var(--accent); border-top-color: transparent; }
.ptr.is-loading { -webkit-animation: ptr-spin .7s linear infinite; animation: ptr-spin .7s linear infinite; }
@-webkit-keyframes ptr-spin { from { -webkit-transform: translateY(48px) rotate(0); } to { -webkit-transform: translateY(48px) rotate(360deg); } }
@keyframes ptr-spin { from { transform: translateY(48px) rotate(0); } to { transform: translateY(48px) rotate(360deg); } }

/* Телефон: шапка раздела в строку, перемотка во всю ширину, кнопки без переносов */
.player__bar .btn { white-space: nowrap; line-height: 1.5rem; }
@media (max-width: 699px) {
  .unit-head { flex-direction: row; align-items: center; margin-bottom: 1.4rem; }
  .unit-head__cover { width: 6.5rem; min-width: 6.5rem; margin: 0 1rem 0 0; }
  .unit-head__info { min-width: 0; }
  .unit-head__info h1 { font-size: 1.5rem; }
  .unit-head__info .eyebrow { margin-bottom: .3rem; }
  .scrub { -webkit-flex-wrap: wrap; flex-wrap: wrap; }
  .scrub__range { -webkit-order: -1; order: -1; -webkit-flex: 0 0 100%; flex: 0 0 100%; margin: .4rem 0 .6rem; }
  .scrub__time { -webkit-flex: 1; flex: 1; }
}
@media (max-width: 479px) {
  .player__bar .btn { padding-top: .6rem; padding-bottom: .6rem; }
}

/* Офлайн: кнопка, метка скачанного у выпуска, без сети нескачанное приглушено */
.player__bar .btn--icon { color: #c9cdd8; }
.player__bar .btn--icon:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.player__bar #offline.is-saved { color: var(--accent); }
.bar-pct { margin-left: .3rem; vertical-align: middle; font-size: .85rem; font-variant-numeric: tabular-nums; }
.bar-pct:empty { display: none; }
.player__bar #offline[disabled] { opacity: .4; cursor: default; }
.track[data-saved] .track__dur:before {
  content: ''; display: inline-block; width: .45rem; height: .45rem; margin: 0 .5rem .1rem 0; border-radius: 50%;
  background: var(--accent); vertical-align: middle;
}
.is-offline .track:not([data-saved]), .is-offline .recent__play:not([data-saved]) { opacity: .35; }

/* Правка плейлиста на витрине (админ) */
.tracks-tools { text-align: right; margin: -.6rem 0 .3rem; }
/* Иконки (Heroicons): у кнопки-переключателя две — обычная и «включено» (.is-on) */
.ico { display: inline-block; vertical-align: middle; width: 1.35rem; height: 1.35rem; }
.btn .ico--on, .btn.is-on .ico--off { display: none; }
.btn.is-on .ico--on { display: inline-block; }
.tracks li { position: relative; }
.track__del { display: none; position: absolute; top: 50%; right: .4rem; margin: -1.4rem 0 0; }
.tracks.is-editing .track__del { display: block; }
.tracks.is-editing .track { padding-right: 3.6rem; }
.tracks.is-editing .track__dur { display: none; }
.track__x {
  display: block; width: 2.8rem; height: 2.8rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 90, 110, .1); color: var(--danger); font: 400 1.7rem/2.8rem Arial, sans-serif;
}
.track__x:hover, .track__x:focus { background: rgba(255, 90, 110, .25); }
/* Режим офлайна: у выпуска кнопка «в офлайн» на месте длительности — стрелка, проценты загрузки или галочка */
.track__keep {
  display: none; position: absolute; top: 50%; right: .4rem; margin: -1.4rem 0 0; min-width: 2.8rem; height: 2.8rem; padding: 0 .5rem;
  border: 0; border-radius: 999px; cursor: pointer; background: rgba(255, 255, 255, .06); color: #c9cdd8; font: inherit; font-size: .85rem; font-weight: 600;
}
.track__keep:hover, .track__keep:focus { background: rgba(255, 255, 255, .12); color: #fff; }
.track__keep:disabled { opacity: .35; cursor: default; }
.track__keep .ico { width: 1.4rem; height: 1.4rem; }
.track__keep-done, .track__keep.is-saved .track__keep-get, .track__keep.is-busy .track__keep-get { display: none; }
.track__keep.is-saved .track__keep-done { display: inline-block; }
.track__keep.is-saved { color: var(--accent); background: rgba(255, 122, 69, .12); }
.track__keep-pct { font-variant-numeric: tabular-nums; }
.tracks.is-keeping .track__keep { display: block; }
.tracks.is-keeping .track, .tracks.is-getting .track { padding-right: 4.4rem; }
.tracks.is-keeping .track__dur, .tracks.is-getting .track__dur { display: none; }
/* Режим «скачать файлы»: у выпуска ссылка на файл — сохранить на диск */
.track__get {
  display: none; position: absolute; top: 50%; right: .4rem; margin: -1.4rem 0 0; width: 2.8rem; height: 2.8rem; border-radius: 50%;
  background: rgba(255, 255, 255, .06); color: #c9cdd8; text-align: center; line-height: 2.8rem;
}
.track__get:hover, .track__get:focus { background: rgba(255, 255, 255, .12); color: #fff; }
.track__get .ico { width: 1.4rem; height: 1.4rem; }
.tracks.is-getting .track__get { display: block; }

/* ---------- Статистика ---------- */
.stats { display: flex; flex-wrap: wrap; margin: -6px -6px 2rem; }
.stat { flex: 1 1 0; min-width: 0; margin: 6px; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid rgba(255,255,255,.05); }
.stat--hero { flex-basis: 100%; }
.stat__label { display: block; color: var(--muted); font-size: .85rem; }
.stat__value { display: block; margin-top: .3rem; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat--hero .stat__value { font-size: 2.4rem; color: var(--accent); }
@media (max-width: 480px) {
  .stat { padding: .85rem .8rem; }
  .stat__value { font-size: 1.05rem; }
  .stat--hero .stat__value { font-size: 1.75rem; }  /* «18 дней 23 часа 3 минуты» — в две строки, не в три */
}
/* Втроём в ряд на телефоне «10 часов 57 минут» и строки «Сегодня / 7 дней / 30 дней» не помещаются — плитки по одной в строку,
   у «Сегодня / 7 дней / 30 дней» подпись слева, время справа. Длинное время переносится между парами «число слово»
   (внутри пары — неразрывный пробел). */
@media (max-width: 600px) {
  .stat { flex-basis: 100%; }
  .stat:not(.stat--hero):not(.stat--kind) { display: flex; justify-content: space-between; align-items: baseline; }
  .stat:not(.stat--hero):not(.stat--kind) .stat__value { margin: 0 0 0 .5rem; text-align: right; }
}
.chart { margin-bottom: 2.2rem; }
.chart__bars { display: flex; align-items: flex-end; height: 9rem; border-bottom: 1px solid var(--line); }
.chart__col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; padding: 0 1px; outline: none; cursor: default; }
.chart__col.is-sunday { border-right: 1px dashed rgba(255,255,255,.07); }
.chart__stack { display: flex; flex-direction: column; justify-content: flex-end; width: 100%; height: 100%; }
.chart__bar { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--c-audio); opacity: .9; }
.chart__bar--video { background: var(--c-video); }
.chart__bar--book { background: var(--c-book); }
.chart__bar + .chart__bar { border-radius: 0; margin-top: 2px; }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.chart__legend { color: var(--muted); font-size: .85rem; }
.chart__legend > span { margin-left: 1rem; white-space: nowrap; }
/* На телефоне легенда в строку с заголовком не помещается (крупный шрифт, узкий экран) — под заголовок, с переносом по пунктам. */
@media (max-width: 600px) {
  .chart__head { display: block; margin-bottom: .9rem; }
  .chart__head h2 { margin-bottom: .35rem; }
  .chart__legend { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
  .chart__legend > span { margin: 0 1rem .2rem 0; }
}
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .4rem; vertical-align: -.05rem; background: var(--c-audio); }
.swatch--video { background: var(--c-video); }
.swatch--book { background: var(--c-book); }
/* В карточке вида итог — справа от названия, как сумма дня в истории. */
.stat__head { display: flex; justify-content: space-between; align-items: baseline; }
.stat__head .stat__label { white-space: nowrap; }
.stat__head .stat__value { margin: 0 0 0 .75rem; text-align: right; font-size: 1.1rem; }
/* Втроём в ряд итог справа от названия помещается только на широком экране — уже (iPad стоя) по одной в ряд. */
@media (max-width: 900px) { .stat--kind { flex-basis: 100%; } }
.stat__rows { display: block; margin-top: .7rem; font-size: .85rem; }
.stat__rows > span { display: flex; justify-content: space-between; padding: .2rem 0; border-top: 1px solid rgba(255,255,255,.05); }
.stat__rows > span > span:first-child { color: var(--muted); margin-right: .5rem; white-space: nowrap; }
.stat__rows > span > span:last-child { font-variant-numeric: tabular-nums; text-align: right; }
.chart__col:hover .chart__bar, .chart__col:focus .chart__bar { opacity: 1; }
.chart__col:hover::after, .chart__col:focus::after {
  /* Каждый вид — своей строкой (переводы строк в data-tip): в одну строку на телефоне не помещалось. */
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  white-space: pre; padding: .35rem .6rem; border-radius: 8px; background: #23262f; color: var(--text); line-height: 1.45;
  font-variant-numeric: tabular-nums;
  font-size: .8rem; box-shadow: var(--shadow); pointer-events: none; z-index: 2;
}
.chart__col:nth-child(-n+6):hover::after, .chart__col:nth-child(-n+6):focus::after { left: 0; transform: none; }
.chart__col:nth-last-child(-n+6):hover::after, .chart__col:nth-last-child(-n+6):focus::after { left: auto; right: 0; transform: none; }
.chart__axis { display: flex; justify-content: space-between; margin-top: .4rem; color: var(--muted); font-size: .8rem; }
.toplist__list { list-style: none; margin: 0; padding: 0; }
.toplist__item { display: flex; align-items: center; padding: .5rem; margin: 0 -.5rem; border-radius: var(--radius); color: inherit; text-decoration: none; }
a.toplist__item:hover { background: rgba(255,255,255,.04); }
.toplist__cover { flex: 0 0 3.2rem; width: 3.2rem; margin-right: .9rem; }
.toplist__cover--gone { -webkit-filter: grayscale(1); filter: grayscale(1); }  /* удалённое — чёрно-белым */
.toplist__body { flex: 1 1 auto; min-width: 0; }
.toplist__title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist__meta { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.toplist__bar { display: block; height: 4px; margin-top: .45rem; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; }
.toplist__bar span { display: block; height: 100%; border-radius: 2px; background: var(--c-audio); }
.toplist__bar--video span { background: var(--c-video); }
.toplist__bar--book span { background: var(--c-book); }
/* История: по дням, у дня — сколько всего */
.history { margin-bottom: 2rem; }
.history h2 { display: flex; align-items: baseline; justify-content: space-between; }
.history__total { color: var(--muted); font-size: .85rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.history__more { text-align: center; }

/* Ссылка на приложение — только в браузере на Android (показывает front.js) */
.get-app { text-align: center; margin: 2rem 0 0; }
/* Уведомления — в строке заголовка «Медиатека», слева: по центру страницы кнопка висела в пустоте, когда категорий меньше, чем колонок */
.hero-title--row { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-align-items: center; align-items: center; }
.hero-title--row h1 { margin-right: 1.2rem; }
.hero-title .get-push { margin: .4rem 0; }
/* Новое: метка на обложке раздела или категории и в списке выпусков, пока выпуск не начали слушать */
.badge-new { position: absolute; top: 10px; left: 10px; z-index: 1; padding: .2rem .6rem; border-radius: 999px; background: var(--accent); color: #0d0e12; font-size: .78rem; font-weight: 700; line-height: 1.4; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.badge-new[data-href] { cursor: pointer; -webkit-transition: background .15s, -webkit-transform .15s; transition: background .15s, transform .15s; }
.badge-new[data-href]:hover { background: #ff8b5c; -webkit-transform: scale(1.05); transform: scale(1.05); }
.tag--new { background: var(--accent); color: #0d0e12; }

/* Мини-плеер приложения для Android: что играет — внизу любой страницы */
.mini {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  padding: .6rem 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
  touch-action: pan-y;  /* свайп влево — закрыть выпуск */
}
.mini[hidden] { display: none; }
.mini__progress { position: absolute; left: 0; right: 0; top: -1px; height: 2px; }
.mini__progress span { display: block; width: 0; height: 100%; background: var(--accent); }
.mini__link { -webkit-flex: 1; flex: 1; min-width: 0; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; color: inherit; text-decoration: none; }
.mini__cover { -webkit-flex-shrink: 0; flex-shrink: 0; width: 3.2rem; height: 3.2rem; margin-right: .8rem; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.mini__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mini__text { min-width: 0; }
.mini__unit { display: block; color: var(--accent-2); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini__title { display: block; color: #fff; font-weight: 700; line-height: 1.3; margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini__play {
  -webkit-flex-shrink: 0; flex-shrink: 0; width: 3.4rem; height: 3.4rem; margin-left: .8rem; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; color: #1a0d06;
  background: var(--accent); background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
.mini__play svg { display: block; width: 46%; height: 46%; margin: 0 auto; fill: currentColor; }
.mini__play .mini__i-pause, .mini__play.is-playing .mini__i-play { display: none; }
.mini__play.is-playing .mini__i-pause { display: block; }
body.has-mini { padding-bottom: 4.8rem; }
.app-foot { margin-top: -2.5rem; padding: 0 16px 1.5rem; text-align: center; color: var(--muted); font-size: .8rem; }

/* Книги — сеткой обложек (как библиотека «Книг»); у обложки — кнопка «сохранить для чтения без сети» (public/books.js). */
.grid > .book-cell { position: relative; width: calc(50% - 16px); margin: 8px; }
@media (min-width: 640px) { .grid > .book-cell { width: calc(33.333% - 16px); } }
@media (min-width: 960px) { .grid > .book-cell { width: calc(25% - 16px); } }
@media (min-width: 1280px) { .grid > .book-cell { width: calc(20% - 16px); } }
.book-cell .card { height: 100%; }
.book__title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .06); }
.book__bar span { display: block; height: 100%; background: var(--c-book); }
.book__keep {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 2.6rem; height: 2.6rem; padding: 0;
  border: 0; border-radius: 999px; cursor: pointer; background: rgba(13, 14, 18, .72); color: #e8e9ee;
}
.book__keep[hidden] { display: none; }
.book__keep:hover, .book__keep:focus { background: rgba(13, 14, 18, .9); color: #fff; }
.book__keep:disabled { opacity: .35; cursor: default; }
.book__keep .ico { width: 1.35rem; height: 1.35rem; }
.book__keep-done, .book__keep.is-saved .book__keep-get { display: none; }
.book__keep.is-saved .book__keep-done { display: inline-block; }
.book__keep.is-saved { color: var(--accent); }
.book__keep.is-busy { opacity: .6; }
/* Правка книг (админ): «×» на обложке, слева сверху */
.book__del { display: none; position: absolute; top: 8px; left: 8px; z-index: 2; margin: 0; }
.books.is-editing .book__del { display: block; }
.book__del .track__x { background: rgba(13, 14, 18, .8); }
.book__del .track__x:hover, .book__del .track__x:focus { background: rgba(120, 20, 35, .9); }
