:root {
  --bg: #0a0c11;
  --surface: #151822;
  --surface-2: #1d2230;
  --border: #2a3040;
  --text: #f3f0e8;
  --text-dim: #8f96a8;
  --accent: #ff7a45;
  --accent-2: #ffb347;
  --accent-soft: rgba(255, 122, 69, 0.14);
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(circle at 15% -10%, rgba(255, 122, 69, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', Arial, sans-serif;
  min-height: 100vh;
}

h1, h2 { font-family: 'Manrope', 'Inter', Arial, sans-serif; }

header {
  padding: 20px 36px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(21, 24, 34, 0.6);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--text) 0%, var(--accent-2) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 0 rgba(255, 122, 69, 0));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.logo-link:hover .logo-img {
  transform: scale(1.08) rotate(-4deg);
  filter: drop-shadow(0 0 8px rgba(255, 122, 69, 0.45));
}

.logo-link:hover h1 {
  filter: brightness(1.15);
}

.logo-link h1 {
  transition: filter 0.25s ease;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--accent-2);
}

.admin-logout-btn {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

main {
  padding: 36px;
  max-width: 1400px;
  margin: 0 auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.controls input,
.controls select {
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.controls input:focus,
.controls select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.controls input {
  flex: 1;
  min-width: 200px;
}

.controls select {
  min-width: 130px;
}

#favorites-toggle {
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

#favorites-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

#favorites-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 24px;
}

/* ---------- Главная страница: горизонтальные ленты по секциям ---------- */

#home-sections {
  display: none; /* переключается в script.js в зависимости от того, активны ли фильтры */
}

.section-row {
  margin-bottom: 36px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

.row-track {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.row-track::-webkit-scrollbar {
  height: 8px;
}

.row-track::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.row-track .card {
  flex: 0 0 190px;
  scroll-snap-align: start;
}

@media (max-width: 600px) {
  .row-track .card {
    flex-basis: 150px;
  }
}

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

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

.poster-wrap {
  position: relative;
}

.card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.favorite-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(10, 12, 17, 0.55);
  backdrop-filter: blur(4px);
  color: #f3f0e8;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.favorite-btn:hover {
  transform: scale(1.12);
  background: rgba(10, 12, 17, 0.8);
}

.favorite-btn.active {
  color: var(--accent);
}

.type-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(10, 12, 17, 0.65);
  backdrop-filter: blur(4px);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.2px;
}

.rating-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(10, 12, 17, 0.75);
  backdrop-filter: blur(4px);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
}

.card .info {
  padding: 12px 14px;
}

.card .title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.card .year {
  color: var(--text-dim);
  font-size: 12px;
}

.player {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, 0.96);
  backdrop-filter: blur(6px);
  padding: 26px 36px 48px;
  flex-direction: column;
  overflow-y: auto;
}

.player.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.player-top h2 {
  font-size: 20px;
}

.player-top button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.player-top button:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

#player-video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: var(--radius);
}

#player-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  background: #000;
  border-radius: var(--radius);
  border: 0;
}

#player-desc {
  margin-top: 16px;
  color: var(--text-dim);
  max-width: 800px;
  line-height: 1.5;
}

.player-top-buttons {
  display: flex;
  gap: 8px;
}

#player-speed {
  min-width: 52px;
}

.continue-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(5, 6, 9, 0.8);
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.3px;
}

/* Спиннер буферизации — показывается поверх видео, пока плеер ждёт данные */
.player::after {
  content: "";
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

.player.buffering::after {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Оценки и комментарии ---------- */

.detail-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  max-width: 1000px;
  animation: fadeIn 0.25s ease;
}

.rating-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  align-self: start;
}

.rating-block-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.rating-icon {
  font-size: 26px;
  line-height: 1;
}

.rating-average {
  font-size: 20px;
  font-weight: 800;
  font-family: 'Manrope', 'Inter', Arial, sans-serif;
}

.rating-count {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.rating-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.rating-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.rating-btn:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.rating-btn:active {
  transform: translateY(1px);
}

.rating-btn.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #17130c;
}

.rating-hint {
  min-height: 16px;
  margin-top: 10px;
  font-size: 12.5px;
}

.comments-block h3 {
  font-size: 16px;
  margin-bottom: 14px;
}

.comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-form textarea {
  flex: 1;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 44px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-form button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #17130c;
  border: none;
  border-radius: var(--radius);
  padding: 0 18px;
  height: 44px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  transition: filter 0.15s ease;
}

.comment-form button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.comment-form button:disabled {
  opacity: 0.55;
  cursor: default;
}

.comment-login-hint {
  font-size: 13.5px;
  color: var(--text-dim);
}

.comment-login-hint a {
  color: var(--accent-2);
}

#comment-message {
  min-height: 16px;
  margin-top: 8px;
  font-size: 12.5px;
  color: #e08080;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.comments-empty {
  color: var(--text-dim);
  font-size: 13.5px;
}

.comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  animation: fadeIn 0.2s ease;
}

.comment-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 10px;
}

.comment-username {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--accent-2);
}

.comment-date {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.comment-text {
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .detail-section {
    grid-template-columns: 1fr;
  }
}

/* ---------- Подвал сайта (компактная строка) ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 16px 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-dim);
  opacity: 0.75;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11.5px;
  transition: color 0.15s ease;
}

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

.footer-age {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

/* ---------- Отдельные страницы: соглашение, конфиденциальность, cookie ---------- */

.legal-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 36px 80px;
  color: var(--text);
}

.legal-main h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.legal-updated {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-bottom: 32px;
}

.legal-main h2 {
  font-size: 16px;
  margin: 30px 0 10px;
  color: var(--accent-2);
}

.legal-main p, .legal-main li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.legal-main ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.legal-main a {
  color: var(--accent-2);
}
