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

:root {
  --bg: #0a0c12;
  --bg-2: #10131c;
  --card: rgba(20, 24, 34, 0.7);
  --border: rgba(120, 140, 200, 0.12);
  --border-hover: rgba(120, 160, 255, 0.35);
  --text: #e6ebf5;
  --text-dim: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #7b5bff;
  --green: #38d39f;
  --red: #ff5b6e;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(91, 140, 255, 0.15), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(123, 91, 255, 0.12), transparent 50%),
    var(--bg);
}

/* Дождь */
#rain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
}

/* Сетка */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(120, 140, 200, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 140, 200, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}

.glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}
.glow-1 { top: -100px; left: -100px; background: #5b8cff; }
.glow-2 { bottom: -150px; right: -100px; background: #7b5bff; }

/* Навбар */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(10, 12, 18, 0.75);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}
.logo-bracket { color: var(--accent); }
.accent { color: var(--accent); }

.nav-actions { display: flex; gap: 10px; align-items: center; }

/* Кнопки */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(91, 140, 255, 0.45); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, 0.06); }
.btn-danger {
  background: rgba(255, 91, 110, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 91, 110, 0.3);
}
.btn-danger:hover { background: rgba(255, 91, 110, 0.25); }
.btn-full { width: 100%; }

/* Hero */
.hero {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px 60px;
}
.hero-content { max-width: 780px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(56, 211, 159, 0.1);
  border: 1px solid rgba(56, 211, 159, 0.25);
  border-radius: 100px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  margin-bottom: 24px;
}
.dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, #5b8cff, #b98cff, #5b8cff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 4s linear infinite;
}
@keyframes shine {
  to { background-position: 200% center; }
}
.hero-sub {
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 560px;
}
.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.stat-num {
  font-size: 28px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}
.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Секция модов */
.mods-section {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.search-input {
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  min-width: 240px;
  transition: border 0.2s;
}
.search-input:focus { border-color: var(--accent); }

/* Сетка */
.mods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.mod-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mod-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent, rgba(91, 140, 255, 0.4), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.mod-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: 0 20px 50px rgba(91, 140, 255, 0.15);
}
.mod-card:hover::before { opacity: 1; }

.mod-head {
  display: flex;
  gap: 12px;
  align-items: center;
}
.mod-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.mod-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
  word-break: break-word;
}
.mod-author-small {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.mod-short {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
  flex-grow: 1;
}
.mod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.mod-footer .date { opacity: 0.7; }
.mod-arrow { color: var(--accent); transition: transform 0.2s; }
.mod-card:hover .mod-arrow { transform: translateX(4px); }

/* Пустое состояние */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Футер */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* Модалки */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 7, 12, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal.hidden { display: none; }
.modal:not(.hidden) { opacity: 1; pointer-events: auto; }

.modal-box {
  background: linear-gradient(180deg, rgba(22, 26, 38, 0.95), rgba(15, 18, 26, 0.98));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-box-wide { max-width: 520px; }
.modal-box-view { max-width: 480px; }
@keyframes modalIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text); border-color: var(--border-hover); }

.modal-box h3 {
  font-size: 22px;
  margin-bottom: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-group input,
.input-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  resize: vertical;
}
.input-group input:focus,
.input-group textarea:focus { border-color: var(--accent); }

.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 16px;
}
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.modal-actions .btn { flex: 1; }

.view-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.view-avatar {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.view-head h3 { margin: 0 0 4px; font-size: 20px; }
.view-meta {
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.view-full {
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 14.5px;
  margin-bottom: 24px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Тосты */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 24, 34, 0.95);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
.toast:not(.hidden) { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(56, 211, 159, 0.5); }
.toast.error { border-color: rgba(255, 91, 110, 0.5); }

.hidden { display: none !important; }

/* Мобилка */
@media (max-width: 640px) {
  .nav-inner { padding: 14px 16px; }
  .logo { font-size: 17px; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .hero { padding: 50px 16px 40px; }
  .hero h1 { letter-spacing: -1px; }
  .hero-stats { gap: 24px; }
  .stat-num { font-size: 22px; }
  .section-head { flex-direction: column; align-items: stretch; }
  .search-input { min-width: 0; }
  .mods-grid { grid-template-columns: 1fr; }
  .modal-box { padding: 24px 20px; border-radius: 16px; }
  .glow { width: 250px; height: 250px; filter: blur(90px); }
}

/* Скроллбар */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(120, 140, 200, 0.2);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(120, 140, 200, 0.4); }

/* ---------- Кнопки админа на карточке ---------- */
.card-admin-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.25s ease;
  z-index: 5;
}
.mod-card:hover .card-admin-actions { opacity: 1; transform: translateY(0); }

/* На тач-устройствах всегда показываем кнопки админа */
@media (hover: none) {
  .card-admin-actions { opacity: 1; transform: none; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}
.icon-btn:hover { transform: scale(1.08); }
.icon-btn.edit:hover {
  border-color: rgba(91, 140, 255, 0.6);
  background: rgba(91, 140, 255, 0.15);
}
.icon-btn.delete:hover {
  border-color: rgba(255, 91, 110, 0.6);
  background: rgba(255, 91, 110, 0.15);
}

/* ---------- Кнопки админа в модалке просмотра ---------- */
.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.admin-actions .btn { flex: 1; }

/* ---------- Кнопки админа на карточке ---------- */
.card-admin-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.25s ease;
  z-index: 5;
}
.mod-card:hover .card-admin-actions { opacity: 1; transform: translateY(0); }
@media (hover: none) {
  .card-admin-actions { opacity: 1; transform: none; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}
.icon-btn:hover { transform: scale(1.08); }
.icon-btn.edit:hover { border-color: rgba(91, 140, 255, 0.6); background: rgba(91, 140, 255, 0.15); }
.icon-btn.delete:hover { border-color: rgba(255, 91, 110, 0.6); background: rgba(255, 91, 110, 0.15); }

/* ---------- Аватарки (img и video) ---------- */
.mod-avatar, .view-avatar, .mod-page-avatar {
  object-fit: cover;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: block;
}
video.mod-avatar, video.view-avatar, video.mod-page-avatar {
  pointer-events: none;
}

.view-avatar-wrap { width: 72px; height: 72px; flex-shrink: 0; }
.view-avatar-wrap .view-avatar,
.view-avatar-wrap video.view-avatar { width: 100%; height: 100%; border-radius: 16px; }

/* ---------- Кнопки в модалке просмотра ---------- */
.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.admin-actions .btn { flex: 1; }

/* ============================================ */
/*           ПОЛНАЯ СТРАНИЦА МОДА                */
/* ============================================ */
.mod-page {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.back-link {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 32px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

.mod-page-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
  font-size: 15px;
}

.mod-page-head {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.mod-page-avatar-wrap {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.mod-page-avatar,
.mod-page-avatar-wrap video.mod-page-avatar {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  object-fit: cover;
}

.mod-page-head-info { flex: 1; min-width: 220px; }
.mod-page-head-info h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 8px;
  word-break: break-word;
}
.mod-page-short {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.mod-page-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  background: rgba(91, 140, 255, 0.08);
  border: 1px solid rgba(91, 140, 255, 0.2);
  border-radius: 100px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.mod-page-full {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 24px;
}

/* ---------- Галерея обзоров ---------- */
.gallery-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.gallery-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}
.gallery-viewer {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.gallery-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.gallery-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  min-width: 60px;
  text-align: center;
}

/* ---------- Список обзоров в форме редактирования ---------- */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.review-empty {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}
.review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.review-preview {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.review-preview img,
.review-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.review-url {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-add {
  display: flex;
  gap: 8px;
}
.review-add input { flex: 1; }
.review-add .btn { white-space: nowrap; }

/* ---------- Мобильная адаптация полной страницы ---------- */
@media (max-width: 640px) {
  .mod-page { padding: 24px 16px 60px; }
  .mod-page-head { gap: 16px; }
  .mod-page-avatar-wrap { width: 88px; height: 88px; }
  .mod-page-full { padding: 18px; font-size: 14.5px; }
  .gallery-viewer { aspect-ratio: 4 / 3; }
}