/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0d0f;
  --bg-card: #16161a;
  --bg-hover: #1e1e24;
  --border: #2a2a32;
  --text: #f0f0f5;
  --text-muted: #9a9aa8;
  --accent: #ff2d55;
  --accent-hover: #ff4d6d;
  --accent-soft: rgba(255, 45, 85, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== AGE GATE ===== */
.age-gate {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a0a12 0%, #0d0d0f 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.age-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 480px;
  text-align: center;
  box-shadow: var(--shadow);
}

.age-logo {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.age-box h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.age-box p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 28px;
}

.age-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.age-note {
  font-size: 12px !important;
  color: #666 !important;
  margin-bottom: 0 !important;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 50px;
  transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 50px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 15, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 48px 10px 18px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input::placeholder {
  color: var(--text-muted);
}

.search-wrap input:focus {
  border-color: var(--accent);
}

.search-wrap button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}

.search-wrap button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-desktop {
  display: flex;
  gap: 8px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 50px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--bg-card);
}

/* ===== CATEGORIES BAR ===== */
.categories-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 64px;
  z-index: 90;
}

.cats-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.cats-scroll::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: all 0.2s;
  white-space: nowrap;
}

.cat-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ===== MAIN ===== */
.main {
  padding: 32px 0 60px;
  min-height: 60vh;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.sort-select select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* ===== VIDEO GRID ===== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #1a1a22;
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.video-card:hover .video-thumb img {
  transform: scale(1.06);
}

/* Красивая заглушка вместо эмодзи */
.thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #1c1520 0%, #2b1225 40%, #1a1a28 100%);
  position: relative;
}

.thumb-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,45,85,0.18), transparent 55%);
}

.play-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 45, 85, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 45, 85, 0.4);
  transition: transform 0.2s, background 0.2s;
  z-index: 2;
}

.video-card:hover .play-icon {
  transform: scale(1.12);
  background: #ff2d55;
}

.play-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
  margin-left: 3px;
}

.thumb-cat {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.4px;
  z-index: 2;
  text-transform: uppercase;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.85);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 3;
}

.video-hd {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 3;
}

.video-info {
  padding: 14px 14px 16px;
}

.video-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.video-cat-tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ===== LOAD MORE ===== */
.load-more-wrap {
  text-align: center;
  margin-top: 40px;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
  max-width: 320px;
}

.footer-links h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.footer-links a {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
}

.footer-bottom p {
  font-size: 12px;
  color: #666;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--accent);
}

.modal-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.modal-player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-info {
  padding: 20px 24px 28px;
}

.modal-info h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}


/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .watch-layout {
    grid-template-columns: 1fr !important;
  }
  .watch-sidebar {
    order: 2;
  }
}

@media (max-width: 900px) {
  .nav-desktop {
    display: none !important;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .logo {
    font-size: 16px;
  }

  .search-wrap {
    order: 3;
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }

  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .cats-scroll {
    gap: 8px;
    padding-bottom: 4px;
  }

  .cat-btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .video-info {
    padding: 8px 10px 10px;
  }

  .video-title {
    font-size: 12.5px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .video-meta {
    font-size: 11px;
    gap: 6px;
  }

  .video-cat-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  .video-duration,
  .video-hd {
    font-size: 10px;
    padding: 2px 5px;
  }

  .age-box {
    padding: 28px 20px;
    margin: 16px;
  }

  .age-box h1 {
    font-size: 20px;
  }

  .age-buttons {
    flex-direction: column;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-header h2 {
    font-size: 18px;
  }

  .footer-content {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .footer-links h4 {
    margin-bottom: 8px;
  }

  .watch-layout {
    padding: 12px 12px 8px !important;
    gap: 16px !important;
  }

  .watch-main h1 {
    font-size: 16px !important;
  }

  .related-thumb {
    width: 120px !important;
  }

  .related-title {
    font-size: 12px !important;
  }

  .more-section {
    padding: 8px 12px 32px !important;
  }

  .more-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .source-btn {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .categories-bar {
    position: sticky;
    top: 56px;
    z-index: 99;
  }
}

@media (max-width: 400px) {
  .video-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .more-grid {
    grid-template-columns: 1fr !important;
  }

  .logo {
    font-size: 15px;
  }

  .cat-btn {
    padding: 5px 10px;
    font-size: 12px;
  }
}

/* Touch-friendly */
@media (hover: none) and (pointer: coarse) {
  .cat-btn,
  .nav-link,
  .video-card,
  .related-item {
    -webkit-tap-highlight-color: transparent;
  }
  .video-card:active {
    opacity: 0.9;
  }
}

a.cat-btn, a.nav-link, a.video-card, a.related-item, a.logo, a.source-btn, a.back-link {
  text-decoration: none;
  color: inherit;
}
a.cat-btn:hover, a.nav-link:hover { color: inherit; }

/* ===== BURGER MENU ===== */
.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}
.burger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text, #eee);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.burger-btn:hover {
  background: rgba(255,255,255,0.06);
}

.mobile-menu[hidden] {
  display: none !important;
}
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.mobile-menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.mobile-menu-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  background: var(--bg-card, #14141c);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mobile-menu-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text, #eee);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.mobile-menu-close:hover {
  background: rgba(255,255,255,0.08);
}
.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow-y: auto;
}
.mobile-menu-link {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text, #eee);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.mobile-menu-link:hover {
  background: rgba(255,255,255,0.06);
}
.mobile-menu-link.active {
  background: rgba(255, 60, 100, 0.15);
  color: var(--accent, #ff3c64);
}

@media (max-width: 900px) {
  .burger-btn {
    display: flex;
  }
  .nav-desktop {
    display: none !important;
  }
  /* Hide horizontal cats bar on small screens — categories in burger */
  .categories-bar {
    display: none;
  }
}

/* On mobile: related sidebar becomes grid like "Ещё видео" */
@media (max-width: 1000px) {
  .watch-sidebar {
    display: block !important;
  }
  .watch-sidebar h3 {
    margin-bottom: 12px;
  }
  .watch-sidebar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .watch-sidebar h3 {
    grid-column: 1 / -1;
  }
  .watch-sidebar .related-item {
    flex-direction: column;
    padding: 0;
    gap: 0;
    background: var(--bg-card, #14141c);
    border-radius: 10px;
    overflow: hidden;
  }
  .watch-sidebar .related-item:hover {
    background: var(--bg-card, #14141c);
    opacity: 0.92;
  }
  .watch-sidebar .related-thumb {
    width: 100% !important;
    aspect-ratio: 16/9;
    border-radius: 0;
  }
  .watch-sidebar .related-info {
    padding: 8px 10px 10px;
  }
  .watch-sidebar .related-title {
    font-size: 12.5px !important;
    -webkit-line-clamp: 2;
  }
  .watch-sidebar .related-meta {
    font-size: 11px;
  }
}

/* Video click-to-play poster */
.player { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; }
.player-poster { position: absolute; inset: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 2; }
.player-poster-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.player-play-btn { position: relative; z-index: 3; border: none; background: transparent; cursor: pointer; filter: drop-shadow(0 4px 12px rgba(0,0,0,.5)); transition: transform .15s; }
.player-play-btn:hover { transform: scale(1.08); }
.player-poster-meta { position: relative; z-index: 3; margin-top: 12px; color: #fff; font-size: 13px; font-weight: 500; text-shadow: 0 1px 4px #000; }
.embed-hint { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; line-height: 1.4; }
