/* ===== ГЛОБАЛЬНЫЕ ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #0a0b0e;
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 70px;
}

/* ===== СКРОЛЛБАР ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0a0b0e;
}
::-webkit-scrollbar-thumb {
  background: #2a2a3a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a3a5a;
}

/* ===== ШАПКА ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 16px;
  background: rgba(10, 11, 14, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Кнопка поиска в шапке */
.header-icon-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  color: #e0e0e0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-icon-btn:hover {
  background: rgba(255,255,255,0.06);
}

/* ===== ГАМБУРГЕР ===== */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  transition: 0.3s;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.hamburger:hover {
  background: rgba(255,255,255,0.06);
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #e0e0e0;
  border-radius: 2px;
  transition: 0.3s;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* ===== МЕНЮ ===== */
.nav-menu {
  display: none;
  background: rgba(16, 18, 22, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 12px;
  margin-top: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.04);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
.nav-menu.open {
  display: block;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.nav-menu ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.nav-menu ul li a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 8px;
  transition: 0.3s;
  cursor: pointer;
  display: inline-block;
}
.nav-menu ul li a:hover {
  background: rgba(108, 92, 231, 0.15);
  color: #a29bfe;
}

/* ===== ПОИСК ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  animation: slideDown 0.25s ease;
}
.search-bar.hidden {
  display: none;
}
.search-bar input {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: #e0e0e0;
  font-size: 0.95rem;
  outline: none;
  transition: 0.3s;
  font-family: 'Inter', sans-serif;
}
.search-bar input::placeholder {
  color: #555;
}
.search-bar input:focus {
  border-color: rgba(108, 92, 231, 0.3);
  background: rgba(255,255,255,0.05);
}
.search-bar button {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: rgba(108, 92, 231, 0.2);
  color: #a29bfe;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.3s;
}
.search-bar button:hover {
  background: rgba(108, 92, 231, 0.3);
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  position: relative;
  z-index: 1;
  min-height: 70vh;
  padding-top: 80px;
}

section {
  display: none;
  animation: fadeIn 0.3s ease;
}
section.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== КАТАЛОГ ===== */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.anime-card {
  background: rgba(255,255,255,0.02);
  border-radius: 14px;
  overflow: hidden;
  transition: 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  position: relative;
}
.anime-card:hover {
  transform: translateY(-4px);
  border-color: rgba(108, 92, 231, 0.15);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.anime-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}
.anime-card .info {
  padding: 10px 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.anime-card .title {
  font-weight: 600;
  font-size: 0.8rem;
  color: #e0e0e0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.anime-card .year {
  font-size: 0.7rem;
  color: #666;
}
.anime-card .episodes {
  font-size: 0.7rem;
  color: #6c5ce7;
  margin-top: 2px;
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(14, 15, 20, 0.98);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #666;
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 12px;
  transition: 0.3s;
  flex: 1;
  max-width: 100px;
}
.bottom-nav-item:hover {
  background: rgba(255,255,255,0.03);
  color: #aaa;
}
.bottom-nav-item.active {
  color: #a29bfe;
}
.bottom-nav-item.active .nav-icon {
  transform: scale(1.15);
}
.bottom-nav-item .nav-icon {
  font-size: 1.3rem;
  transition: 0.3s;
}
.bottom-nav-item .nav-label {
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ===== ПЛЕЕР ===== */
#player-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
  margin-top: 20px;
}
#player-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== ИНФОРМАЦИЯ О ТАЙТЛЕ ===== */
.anime-info {
  margin-top: 20px;
  padding: 20px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.03);
}
.anime-info h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  color: #e0e0e0;
}
.anime-info p {
  color: #888;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ===== ПОСТЕР ===== */
.anime-detail {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}
.anime-detail .poster {
  flex: 0 0 340px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: 0.3s;
}
.anime-detail .poster:hover {
  transform: scale(1.01);
}
.anime-detail .poster img {
  width: 100%;
  height: auto;
  display: block;
}
.anime-detail .info {
  flex: 1;
  min-width: 200px;
}
.anime-detail .info h2 {
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.anime-detail .info .meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: #666;
  font-size: 0.85rem;
  margin: 6px 0 12px;
}
.anime-detail .info .description {
  line-height: 1.7;
  color: #aaa;
}

/* ===== СКРИНШОТЫ ===== */
.screenshots-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.screenshot-item {
  display: block;
  width: 120px;
  height: 67px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  transition: 0.3s;
  cursor: pointer;
}
.screenshot-item:hover {
  transform: scale(1.04);
  border-color: rgba(108, 92, 231, 0.2);
}
.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== ВНЕШНИЕ ССЫЛКИ ===== */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.7rem;
  text-decoration: none;
  transition: 0.3s;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  color: #888;
}
.external-link:hover {
  background: rgba(108, 92, 231, 0.1);
  border-color: rgba(108, 92, 231, 0.15);
  color: #a29bfe;
}

/* ===== КНОПКИ ===== */
.back-btn {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
  color: #ccc;
  padding: 8px 18px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.3s;
}
.back-btn:hover {
  background: rgba(255,255,255,0.06);
}
#load-more-btn {
  display: none;
  margin: 20px auto !important;
  padding: 8px 24px !important;
}

/* ===== LOADER ===== */
.loader {
  text-align: center;
  padding: 40px;
  color: #555;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.loader::before {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid rgba(108, 92, 231, 0.1);
  border-top-color: #6c5ce7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.modal-overlay.open {
  display: flex;
}
.modal-content {
  background: #14161a;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 28px 30px;
  max-width: 460px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #555;
  font-size: 1.5rem;
  cursor: pointer;
  transition: 0.3s;
}
.modal-close:hover {
  color: #ccc;
}
.modal-content h2 {
  color: #e0e0e0;
  font-size: 1.3rem;
  margin-bottom: 14px;
}
.modal-content p {
  color: #888;
  line-height: 1.7;
  font-size: 0.9rem;
}

/* ===== УВЕЛИЧЕННОЕ ИЗОБРАЖЕНИЕ ===== */
.modal-image-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.modal-image-overlay.open {
  display: flex;
}
.modal-image-overlay img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
  object-fit: contain;
}
.modal-image-overlay .close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #888;
  font-size: 2.5rem;
  cursor: pointer;
  transition: 0.3s;
  background: none;
  border: none;
}
.modal-image-overlay .close-btn:hover {
  color: #fff;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 700px) {
  main {
    padding-top: 75px;
  }
  .logo {
    font-size: 1rem;
  }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
  .anime-detail .poster {
    flex: 0 0 260px;
  }
  .screenshot-item {
    width: 80px;
    height: 45px;
  }
}

@media (max-width: 500px) {
  .anime-detail .poster {
    flex: 0 0 200px;
  }
  .screenshot-item {
    width: 60px;
    height: 34px;
  }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
  .bottom-nav-item .nav-label {
    font-size: 0.6rem;
  }
  }
