/* ============================================================
   pages.css — стили, специфичные для отдельных страниц
   Mobile-first: базовые правила — мобильные. Десктоп — в @media (min-width: 800px)
   ============================================================ */

/* ============================================================
   Главная
   ============================================================ */
.home-manifesto {
  max-width: 720px;
}

/* ============================================================
   Профиль
   ============================================================ */
.profile-head .avatar-big {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .profile-head {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .profile-info {
    width: 100%;
  }
}

/* ============================================================
   Админка
   ============================================================ */
.admin-section {
  margin-bottom: 32px;
}

.admin-empty {
  color: var(--muted);
  padding: 12px 0;
  text-align: center;
}

/* ============================================================
   Вход / регистрация
   ============================================================ */
.auth-card {
  margin-bottom: 12px;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* ============================================================
   Правила
   ============================================================ */
.rules-block {
  margin-bottom: 24px;
}

.rules-block:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Блог / changelog
   ============================================================ */
.article-card {
  transition: border-color .15s ease;
}

.article-card:hover {
  border-color: var(--border-2);
}

.article-card h3 {
  margin: 4px 0 8px;
  color: var(--fg);
}

/* ============================================================
   Offline
   ============================================================ */
.offline-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.offline-card {
  max-width: 400px;
}

/* ============================================================
   Хелперы
   ============================================================ */
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent); }

.hidden { display: none !important; }

/* ============================================================
   Общая мобильная адаптация контента
   ============================================================ */
@media (max-width: 600px) {
  .post { padding: 14px; }
  .card { padding: 16px; }

  .bell-dropdown {
    width: calc(100vw - 24px);
    right: -12px;
  }

  .profile-actions { flex-direction: column; }
  .profile-actions .btn-ghost,
  .profile-actions .btn-primary { width: 100%; }

  .post-actions { gap: 10px; font-size: 12px; }
  .post-actions button { font-size: 12px; }
}

/* ============================================================
   Страница 404
   ============================================================ */
.error-page {
  text-align: center;
  padding: 60px 0;
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin-bottom: 16px;
  font-family: var(--font);
}

.error-page h1 {
  font-size: 32px;
  margin-bottom: 12px;
}

.error-page .muted {
  font-size: 16px;
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .error-code { font-size: 80px; }
  .error-page h1 { font-size: 24px; }
}

/* ============================================================
   АНИМЕ — БАЗОВЫЕ (МОБИЛЬНЫЕ) СТИЛИ
   Жёстко 3 колонки, чтобы работало в WebView/APK
   ============================================================ */

.hero {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.hero .muted { font-size: 13px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
}

.section-head .more {
  font-size: 13px;
  color: var(--muted);
}

.section-head .more:hover { color: var(--accent); }

.search-hero {
  margin-top: 14px;
  max-width: 600px;
}

.search-hero input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
}

.search-hero input:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- Сетка карточек: 3 колонки ВСЕГДА (для WebView/APK) --- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-grid.wide {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.media-card {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--fg);
  transition: border-color .15s ease, transform .15s ease;
}

.media-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--fg);
}

.media-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-3);
  overflow: hidden;
}

.media-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-score {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.media-kind {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--fg-2);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.media-body { padding: 6px 8px; }

.media-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 28px;
}

.media-meta {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

/* --- Топ-карточки: 1 колонка на мобильном --- */
.top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.top-card {
  display: flex;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--fg);
  transition: border-color .15s ease;
}

.top-card:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.top-card-poster {
  flex-shrink: 0;
  width: 70px;
  aspect-ratio: 2 / 3;
  background: var(--bg-3);
  overflow: hidden;
}

.top-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-card-body {
  padding: 8px 10px 8px 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.top-card-rank {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.top-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-card-meta {
  margin-top: auto;
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}

/* --- Жанры --- */
.genres-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.genre-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
  text-decoration: none;
}

.genre-tag:hover,
.genre-tag.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* --- Карточка аниме (мобильная: постер слева, текст справа) --- */
.breadcrumbs {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }

.anime-show {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.anime-show__cover {
  aspect-ratio: 2 / 3;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.anime-show__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.anime-show__title {
  font-size: 18px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.anime-show__subtitle {
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 4px;
}

.anime-show__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}

.anime-show__score {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

.anime-show__badge {
  padding: 2px 7px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 10px;
  color: var(--fg-2);
}

.anime-show__genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}

.anime-show__desc {
  color: var(--fg-2);
  line-height: 1.6;
  margin: 10px 0;
  font-size: 13px;
}

.anime-show__actions {
  margin-top: 14px;
}

/* --- Видео-секция: 3 колонки на мобильном --- */
.anime-videos {
  margin-top: 20px;
}

.anime-videos__title {
  font-size: 17px;
  margin-bottom: 10px;
}

.anime-videos__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.anime-video {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--fg);
  transition: border-color .15s ease, transform .15s ease;
}

.anime-video:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--fg);
}

.anime-video__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  overflow: hidden;
}

.anime-video__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.anime-video__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  background: rgba(0, 0, 0, 0.25);
  opacity: 0.9;
  transition: background .15s ease;
}

.anime-video:hover .anime-video__play {
  background: rgba(0, 0, 0, 0.4);
}

.anime-video__meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.anime-video__kind {
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.anime-video__name {
  font-size: 11px;
  color: var(--fg-2);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   Страница «Скачать приложение» — мобильная база
   ============================================================ */

.app-download {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 40px;
}

.app-download__icon { flex-shrink: 0; }

.app-download__icon img {
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 255, 136, 0.15);
}

.app-download__body {
  flex: 1;
  min-width: 0;
}

.app-download__body h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.app-download__body .muted {
  margin-bottom: 20px;
}

.app-download__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.app-download__actions .btn-lg { width: 100%; }

.app-download__note {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.app-features { margin-bottom: 40px; }

.app-features h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.app-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.app-screenshots img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-3);
}

/* ============================================================
   ДЕСКТОП (min-width: 800px)
   ============================================================ */
@media (min-width: 800px) {
  /* Hero */
  .hero {
    padding: 40px 0 32px;
    margin-bottom: 24px;
  }
  .hero h1 { font-size: 32px; }
  .hero .muted { font-size: 14px; }

  .search-hero { margin-top: 20px; }
  .search-hero input {
    padding: 14px 20px;
    font-size: 15px;
  }

  .section-head { margin-bottom: 16px; }
  .section-head h2 { font-size: 20px; }

  /* Сетки — auto-fill на десктопе */
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }

  .media-grid.wide {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .media-body { padding: 10px 12px; }
  .media-title { font-size: 13px; min-height: 34px; margin-bottom: 4px; }
  .media-meta { font-size: 11px; }
  .media-score, .media-kind { font-size: 11px; padding: 2px 8px; border-radius: 10px; }

  .top-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
  }
  .top-card-poster { width: 100px; }
  .top-card-body { padding: 12px 14px 12px 0; gap: 6px; }
  .top-card-rank { font-size: 22px; }
  .top-card-title { font-size: 15px; }
  .top-card-desc { font-size: 12px; }
  .top-card-meta { font-size: 12px; gap: 10px; }

  .genres-grid { gap: 8px; }
  .genre-tag { padding: 6px 14px; font-size: 13px; }

  .breadcrumbs { font-size: 13px; margin-bottom: 20px; }
  .anime-show {
    grid-template-columns: 280px 1fr;
    gap: 32px;
    padding: 24px;
  }
  .anime-show__title { font-size: 24px; }
  .anime-show__subtitle { font-size: 14px; }
  .anime-show__meta { gap: 8px; margin: 16px 0; }
  .anime-show__score { font-size: 16px; }
  .anime-show__badge { font-size: 12px; padding: 3px 10px; }
  .anime-show__desc { font-size: 14px; margin: 16px 0; }

  .anime-videos { margin-top: 32px; }
  .anime-videos__title { font-size: 20px; margin-bottom: 16px; }
  .anime-videos__grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
  .anime-video__meta { padding: 10px 12px; }
  .anime-video__kind { font-size: 11px; }
  .anime-video__name { font-size: 13px; }
  .anime-video__play { font-size: 34px; }

  /* Страница «Скачать приложение» — десктоп */
  .app-download {
    flex-direction: row;
    text-align: left;
    padding: 32px;
    gap: 32px;
  }
  .app-download__body h2 { font-size: 28px; }
  .app-download__actions { justify-content: flex-start; }
  .app-download__actions .btn-lg { width: auto; }
  .app-features h2 { font-size: 22px; }
  .app-screenshots {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
}

/* --- Очень узкие экраны (до 400px) --- */
@media (max-width: 400px) {
  .media-grid,
  .media-grid.wide,
  .anime-videos__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .anime-show {
    grid-template-columns: 110px 1fr;
    gap: 10px;
    padding: 10px;
  }
  .anime-show__title { font-size: 16px; }
  .anime-show__subtitle { font-size: 11px; }
  .anime-show__badge { font-size: 9px; padding: 2px 6px; }
  .anime-show__desc { font-size: 12px; }
}