/* Вид как у приложения клуба: светло-серый фон, белые карточки, скругление 18, отступ 10,
   картинки-плитки с названием на картинке, чёрная плавающая панель вкладок.
   Цвета и размеры шрифта — по сверке с клубом (2026-10-06). Шрифт клуба Lab Grotesque платный —
   вместо него Inter (свободная лицензия OFL, копия в vendor/inter). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/inter/inter-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/inter/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("vendor/inter/inter-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("vendor/inter/inter-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("vendor/inter/inter-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("vendor/inter/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("vendor/inter/inter-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("vendor/inter/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }


:root {
  --bg: #f0f0f0;
  --card: #ffffff;
  --text: #000000;
  --muted: #808080;
  --line: #e4e4e8;
  --soft: #f2f2f4;
  --accent: #b54656;
  --tabbar: #0b0b0c;
  --tabbar-text: #ffffff;
  --radius: 18px;
  --gap: 10px;
  --pad: 16px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Forum", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10;
    --card: #1b1b1d;
    --text: #f2f2f4;
    --muted: #9a9aa2;
    --line: #2a2a2e;
    --soft: #242427;
    --tabbar: #000000;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f10; --card: #1b1b1d; --text: #f2f2f4; --muted: #9a9aa2;
  --line: #2a2a2e; --soft: #242427; --tabbar: #000000; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { max-width: 560px; margin: 0 auto; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

main { padding: 12px var(--pad) 110px; min-height: 100vh; }

/* ------------------------------------------------ шапка экрана */
.topbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 14px; }
.topbar .back {
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none;
  margin-left: -6px; border-radius: 50%;
}
.topbar .back svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.topbar h1 { margin: 0; font-size: 16.5px; line-height: 1.2; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.topbar .titles { min-width: 0; }
.topbar .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar h1 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------ карточка «профиля» на главной */
.hello {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: var(--gap);
}
.hello .logo {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 30% 30%, #e66b7c, var(--accent) 60%, #7d2232);
  color: #fff; font: 22px var(--serif);
}
.hello b { display: block; font-size: 16px; }
.hello span { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------ карусель баннеров */
.carousel { position: relative; margin-bottom: var(--gap); }
.carousel .track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius);
  scrollbar-width: none;
}
.carousel .track::-webkit-scrollbar { display: none; }
.carousel .slide { flex: 0 0 100%; scroll-snap-align: start; }
.carousel img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.carousel .dots {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 6px;
  background: rgba(0, 0, 0, .35); padding: 5px 8px; border-radius: 10px;
}
.carousel .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.carousel .dots i.on { background: #fff; }

/* ------------------------------------------------ поиск */
.searchbar {
  display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px;
  padding: 0 14px; height: 44px; margin-bottom: var(--gap); color: var(--muted);
}
.searchbar svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; }
.searchbar input {
  flex: 1; border: 0; outline: 0; background: none; font: inherit; color: var(--text); min-width: 0;
}

/* ------------------------------------------------ плитки разделов */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.tile {
  position: relative; display: block; overflow: hidden; border-radius: var(--radius); background: #2a2a2a;
  grid-column: span 2; aspect-ratio: 16 / 9;
}
.tile.half_width { grid-column: span 1; aspect-ratio: 1 / 1; }
.tile.small_bg { aspect-ratio: 32 / 9; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
/* запасная плитка без картинки — в стиле клуба: тёмный фон, светлый шрифт с засечками */
.tile .fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 14px; color: #fff; font: 24px/1.1 var(--serif); text-transform: uppercase; letter-spacing: .5px;
  background: linear-gradient(rgba(0, 0, 0, .45), rgba(0, 0, 0, .55)), var(--cover, #333) center / cover;
}

/* ------------------------------------------------ карточки материалов */
.cards { display: grid; gap: 14px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.card .pic { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--soft); }
/* как у клуба: вводная карточка курса — картинка во всю карточку, название и кнопка поверх */
.card.immersive { position: relative; }
.card.immersive .pic { aspect-ratio: 3 / 4; }
.card.immersive .pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(0, 0, 0, .75)); }
.card.immersive .body { position: absolute; left: 0; right: 0; bottom: 0; color: #fff; }
.card.immersive .body p { color: rgba(255, 255, 255, .85); }
.card.immersive h3 { font-size: 20px; }
.card.immersive .btn { background: #fff; color: #000; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .pic .noimg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center;
  font: 22px/1.15 var(--serif); text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, #3a3a3d, #1c1c1e);
}
.card .body { padding: 12px 14px 14px; }
.card h3 { margin: 0 0 6px; font-size: 16.5px; line-height: 1.25; }
/* как у клуба: краткое описание целиком и чёрным */
.card p { margin: 0 0 12px; color: var(--text); font-size: 14px; line-height: 1.45; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.badge { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 9px; background: var(--soft); }
.badge.lock { background: #fdeaea; color: #a33; }
.actions { display: flex; gap: 8px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px;
  border: 0; border-radius: 12px; background: var(--soft); font-weight: 700; font-size: 13px;
}
.btn.accent { background: var(--accent); color: #fff; }
.btn.icon { flex: 0 0 42px; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn.on svg { fill: currentColor; }

/* ------------------------------------------------ страница материала */
.player { border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 10px; }
/* вертикальные видео — во весь рост, как у клуба (пропорции подставляются по самому видео) */
.player video, .hero-cover { width: 100%; aspect-ratio: 16 / 9; max-height: 78vh; display: block; background: #000; object-fit: contain; }
.hero-cover { object-fit: cover; border-radius: var(--radius); margin-bottom: 10px; }
.parts { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.parts button {
  flex: none; border: 0; border-radius: 12px; padding: 8px 14px; background: var(--card); font-weight: 600;
}
.parts button.on { background: var(--accent); color: #fff; }
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: var(--gap); }
.panel h2 { margin: 0 0 10px; font-size: 22px; line-height: 1.2; }
.panel .actions { margin-top: 12px; }
.files { margin-bottom: 14px; }
.files .file {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line);
}
.files .file:last-child { border-bottom: 1px solid var(--line); }
.files .ico {
  flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--card); font-weight: 700; font-size: 11px; color: var(--accent);
}
.files .name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.3; }
.files .name small { display: block; color: var(--muted); font-size: 12.5px; }
.btn.small { flex: none; height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }

/* PDF на странице: панель (страниц, масштаб) и страницы одна под другой */
.pdf:empty { display: none; }
.pdf { margin: 0 calc(-1 * var(--pad)) 16px; background: var(--soft); }
.pdf-status { padding: 24px var(--pad); color: var(--muted); text-align: center; }
.pdf-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 8px var(--pad); background: var(--soft); border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.pdf-bar .z { display: flex; align-items: center; gap: 8px; }
.pdf-bar .z b { min-width: 44px; text-align: center; font-weight: 600; }
.pdf-bar button {
  width: 32px; height: 32px; border: 0; border-radius: 9px; background: var(--card); font-size: 18px; line-height: 1;
}
.pdf-scroll { overflow-x: auto; }
.pdf-pages { display: flex; flex-direction: column; gap: 8px; padding: 8px; min-width: 100%; }
.pdf-page { width: 100%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }

/* фото галереи: лента (листается пальцем) и просмотр на весь экран */
.photos { position: relative; margin-bottom: 12px; }
.photos .track {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.photos .track::-webkit-scrollbar, .lightbox .track::-webkit-scrollbar { display: none; }
.photos .slide {
  flex: 0 0 100%; padding: 0; border: 0; background: var(--soft); border-radius: var(--radius);
  overflow: hidden; scroll-snap-align: start; cursor: zoom-in;
}
.photos.many .slide { flex-basis: 92%; }
/* фото целиком, как у клуба (бывают схемы-инфографики — обрезать нельзя) */
.photos img { width: 100%; height: 62vh; max-height: 560px; object-fit: contain; }
.photos .count, .lightbox .count {
  position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 10px;
}
.lightbox { position: fixed; inset: 0; z-index: 50; background: #000; }
.lightbox .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lightbox .slide { flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: start; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .close {
  position: absolute; left: 12px; top: 12px; z-index: 1; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 18px;
}
.lightbox .count { left: auto; bottom: auto; top: 20px; right: 14px; }
.actions.mat { margin-bottom: 14px; }
.actions.mat .btn { flex: 0 1 auto; height: 38px; padding: 0 14px; font-size: 13px; background: var(--card); }

/* текст материала и статьи — во всю ширину, как документ (у материала — с переносами строк автора);
   фон, размер и цвет — как у клуба */
.doc { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; margin: 4px 0 18px; }
.doc li > p { margin: 0; }                       /* «рыхлые» списки статей — как обычные */
.doc.pre { white-space: pre-wrap; }
.doc p { margin: 0 0 12px; }
.doc a { color: var(--accent); text-decoration: underline; }
.doc img { border-radius: 12px; margin: 10px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; white-space: normal; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc h1, .doc h2, .doc h3, .doc h4 { line-height: 1.25; margin: 16px 0 6px; }
.doc h2 { font-size: 20px; }
.doc h3 { font-size: 16.5px; }
.doc h4 { font-size: 15px; }
.doc blockquote {
  margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--soft);
  border-radius: 0 10px 10px 0;
}
.doc .spoiler { background: var(--line); border-radius: 4px; }
.related { margin-bottom: 8px; }

/* аудио «как голосовое»: кнопка, волна (прослушанное — цветом), время и скорость */
.voice {
  display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 16px;
  padding: 10px 12px; margin-bottom: 12px; user-select: none;
}
.voice .vplay {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.voice .vplay svg { width: 22px; height: 22px; fill: currentColor; }
.voice .vbody { flex: 1; min-width: 0; }
.voice .wave { display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.voice .wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--muted); opacity: .45; }
.voice .wave i.on { background: var(--accent); opacity: 1; }
.voice .vmeta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.voice .vtime { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.voice .vspeed {
  border: 0; border-radius: 8px; padding: 2px 8px; font-size: 12.5px; font-weight: 700;
  background: var(--card); color: var(--text);
}
.card .voice { margin: 0 0 12px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.crumbs a { font-size: 13px; padding: 5px 10px; border-radius: 10px; background: var(--soft); }
.notice { background: #fff6e5; color: #6b4b00; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .notice { background: #2b2414; color: #f0d79a; } }

/* ------------------------------------------------ списки, пустые состояния */
.list-title { font-size: 13px; color: var(--muted); margin: 14px 2px 8px; text-transform: uppercase; letter-spacing: .4px; }
.row {
  display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 14px; padding: 8px;
  margin-bottom: 8px;
}
.row img, .row .thumb { width: 96px; aspect-ratio: 16 / 9; border-radius: 10px; object-fit: cover; flex: none; background: var(--soft); }
.row .t { font-weight: 600; font-size: 13px; line-height: 1.3; }
.row .m { color: var(--muted); font-size: 13px; margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

/* ------------------------------------------------ теги (как у клуба: мелкие серые метки) */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tags span { font-size: 11px; font-weight: 500; padding: 4px 9px; border-radius: 8px; background: var(--soft); }
.mtags { margin: 0 0 12px; }
.mtags span { background: var(--card); }

/* ------------------------------------------------ фильтр по тегам */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: var(--gap); }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; border: 0; border-radius: 16px; padding: 7px 14px; background: var(--card);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chips button.on { background: var(--accent); color: #fff; }

/* ------------------------------------------------ календарь */
.seg { display: flex; gap: 4px; background: var(--card); border-radius: 14px; padding: 4px; margin-bottom: 6px; }
.seg a { flex: 1; text-align: center; padding: 8px 6px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg a.on { background: var(--accent); color: #fff; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }
.ev {
  display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 8px;
}
.ev .date {
  flex: none; width: 46px; text-align: center; border-radius: 10px; background: var(--soft); padding: 5px 0;
}
.ev .date b { display: block; font-size: 19px; line-height: 1.1; }
.ev .date span { font-size: 11.5px; color: var(--muted); }
.ev .date.today { background: var(--accent); color: #fff; }
.ev .date.today span { color: #fff; }
.ev .t { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; line-height: 1.3; }
.ev .t small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ev .t small.ok { color: #2e8b57; }
.ev img { flex: none; width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }

/* ------------------------------------------------ панель вкладок */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom));
  width: calc(100% - 24px); max-width: 536px; display: flex; justify-content: space-around;
  background: var(--tabbar); color: var(--tabbar-text); border-radius: 26px; padding: 8px 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25); z-index: 10;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500;
  padding: 4px 4px; opacity: .92; flex: 1; min-width: 0;
}
.tabbar svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.tabbar a.on { color: var(--accent); opacity: 1; }
