:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --card: #10182a;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: rgba(148, 163, 184, 0.2);
  --radius-xl: 18px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.7);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 45%, #000 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  width: 100%;
}

header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: conic-gradient(from 160deg, #60a5fa, #22d3ee, #6366f1, #60a5fa);
  padding: 2px;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.6);
}

.logo-mark-inner {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 0, rgba(248, 250, 252, 0.5), #020617);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: #e5e7eb;
}

.title-block h1 {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.title-block p {
  font-size: 14px;
  color: var(--muted);
  max-width: 520px;
}

.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
}

main {
  flex: 1;
}

/* отступ между секциями (каталоги ↔ видео ↔ админка) */
section + section {
  margin-top: 26px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.file-card {
  background: radial-gradient(circle at top, rgba(148, 163, 184, 0.1), transparent 55%), var(--card);
  border-radius: var(--radius-xl);
  padding: 12px 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.file-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.08), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(96, 165, 250, 0.15), transparent 55%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.file-card:hover::before {
  opacity: 1;
}

/* Адаптивная обложка */
.file-cover-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
}

.file-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background-color: #020617;
  transition: transform 0.25s ease-out;
}

.file-card:hover .file-cover {
  transform: scale(1.03);
}

.file-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px 0;
  flex: 1;
}

.file-title {
  font-size: 15px;
  font-weight: 600;
}

.file-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.meta-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.file-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.download-btn {
  appearance: none;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 7px 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  color: #f9fafb;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
  text-decoration: none;
  white-space: nowrap;
}

.download-btn span {
  font-size: 15px;
}

.hint {
  font-size: 10px;
  color: var(--muted);
}

footer {
  margin-top: 32px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid rgba(30, 64, 175, 0.6);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

a {
  color: #93c5fd;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .wrapper {
    padding-inline: 12px;
  }
  header {
    margin-bottom: 24px;
  }
  .file-card {
    padding: 10px 10px 12px;
  }
}

/* ----- АДАПТИВНАЯ СЕТКА ДЛЯ ВИДЕО ----- */
.file-grid-videos {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.video-card {
  max-width: 100%;
}

.admin-button,
.simple-button {
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font: inherit;
}

.admin-button:hover,
.simple-button:hover {
  border-color: var(--accent);
  color: #e5e7eb;
}

/* ----- УПРОЩЁННЫЙ ВИД (ТАБЛИЦА) ----- */
#simple-view {
  display: none;
}

.simple-table {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  font-size: 13px;
}

.simple-header,
.simple-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr) auto;
  gap: 12px;
  padding: 8px 12px;
  align-items: center;
}

.simple-header {
  background: rgba(15, 23, 42, 0.9);
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.simple-row:nth-child(odd) {
  background: rgba(15, 23, 42, 0.8);
}

.simple-row:nth-child(even) {
  background: rgba(15, 23, 42, 0.95);
}

.simple-main-title {
  font-weight: 600;
}

.simple-main-desc {
  color: var(--muted);
  font-size: 12px;
}

.simple-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.simple-meta span {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
}

.simple-action {
  text-align: right;
}

@media (max-width: 700px) {
  .simple-header,
  .simple-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
  }
  .simple-action {
    text-align: left;
  }
}

/* ----- Админ-панель ----- */
#admin-panel .file-card {
  border-style: dashed;
}

.admin-section {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.admin-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-list {
  font-size: 12px;
  color: var(--muted);
  margin-left: 16px;
  margin-top: 4px;
  line-height: 1.4;
}

.admin-list li + li {
  margin-top: 3px;
}

.admin-toggles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-toggle input {
  accent-color: #22c55e;
}

/* ----- Стартовый выбор режима ----- */
#mode-chooser {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.4), rgba(0, 0, 0, 0.94));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.mode-dialog {
  max-width: 680px;
  width: 100%;
  padding: 18px 16px 20px;
}

.mode-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.mode-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.mode-card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 12px 12px 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.75);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition:
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out,
    border-color 0.15s ease-out,
    background 0.15s ease-out;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 20px 45px rgba(37, 99, 235, 0.7);
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.16), var(--card));
}

.mode-chip {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--muted);
}

.mode-illustration.cards div {
  height: 46px;
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(15, 23, 42, 0.1) 0, rgba(15, 23, 42, 0.9) 55%),
    url("data:image/svg+xml,%3Csvg width='60' height='32' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='60' height='32' rx='5' fill='%231f2937'/%3E%3C/svg%3E");
  border: 1px solid rgba(148, 163, 184, 0.4);
  transform: translateY(0);
  animation: cardsScroll 2.4s ease-in-out infinite;
}

/* небольшие сдвиги по времени, чтобы не прыгали синхронно */
.mode-illustration.cards div:nth-child(1) {
  animation-delay: 0s;
}
.mode-illustration.cards div:nth-child(2) {
  animation-delay: 0.25s;
}
.mode-illustration.cards div:nth-child(3) {
  animation-delay: 0.5s;
}

/* ключевые кадры — имитация лёгкого пролистывания карточек вниз/вверх */
@keyframes cardsScroll {
  0% {
    transform: translateY(0);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.9;
  }
}


/* псевдо-миниатюра карточек */
.mode-illustration.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 столбца */
  gap: 6px;
  overflow: hidden;
  align-items: start;
  justify-items: stretch;
}



.mode-illustration.cards div {
  width: 100%;
  aspect-ratio: 3 / 4; /* делаем мини-карточку, а не длинную полоску */
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(15, 23, 42, 0.12) 0, rgba(15, 23, 42, 0.95) 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='60' height='80' rx='6' fill='%231f2937'/%3E%3C/svg%3E");
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
  transform: translateY(0%);
  opacity: 1;
  animation: cardsScrollItem 2.4s ease-in-out infinite;
}


/* сдвигаем каждую «карточку» по фазе, чтобы был эффект потока */
.mode-illustration.cards div:nth-child(1) {
  animation-delay: 0s;
}
.mode-illustration.cards div:nth-child(2) {
  animation-delay: 0.4s;
}
.mode-illustration.cards div:nth-child(3) {
  animation-delay: 0.8s;
}

@keyframes cardsScrollItem {
  0% {
    transform: translateY(0%);
    opacity: 1;
  }
  35% {
    transform: translateY(-120%);
    opacity: 0;
  }
  36% {
    transform: translateY(120%);
    opacity: 0;
  }
  70% {
    transform: translateY(0%);
    opacity: 1;
  }
  100% {
    transform: translateY(0%);
    opacity: 1;
  }
}


.mode-illustration.simple {
  grid-template-columns: 1fr;
  overflow: hidden;
  row-gap: 8px;
}

.mode-illustration.simple div {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.9), rgba(55, 65, 81, 0.8));
  transform: translateY(0%);
  opacity: 0.8;
  animation: rowsScrollItem 3.2s ease-in-out infinite;
}

.mode-illustration.simple div:nth-child(1) { animation-delay: 0s; }
.mode-illustration.simple div:nth-child(2) { animation-delay: 0.25s; }
.mode-illustration.simple div:nth-child(3) { animation-delay: 0.5s; }
.mode-illustration.simple div:nth-child(4) { animation-delay: 0.75s; }

@keyframes rowsScrollItem {
  0% {
    transform: translateY(0%);
    opacity: 0.8;
  }
  40% {
    transform: translateY(-150%);
    opacity: 0;
  }
  41% {
    transform: translateY(150%);
    opacity: 0;
  }
  80% {
    transform: translateY(0%);
    opacity: 0.9;
  }
  100% {
    transform: translateY(0%);
    opacity: 0.8;
  }
}


.mode-card-title {
  font-size: 14px;
  font-weight: 600;
}

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

.mode-footer-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

@media (max-width: 600px) {
  .mode-dialog {
    padding-inline: 10px;
  }
}

/* ----- Фильтры ----- */
.filters-bar {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  opacity: 0.85;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease,
    transform 0.1s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  opacity: 1;
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #1d4ed8, #22c55e);
  border-color: transparent;
  opacity: 1;
}
