*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0c;
  --sidebar: #111114;
  --card: #16161a;
  --card-hover: #1c1c22;
  --border: #25252d;
  --text: #f2f2f5;
  --muted: #8b8b96;
  --red: #e50914;
  --red-dim: rgba(229, 9, 20, 0.15);
  --gold: #f5c518;
  --radius: 14px;
  --font: "Inter", system-ui, sans-serif;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100dvh;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.sidebar__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.sidebar__block {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.sidebar__block:last-child {
  border-bottom: none;
}

.search {
  position: relative;
}

.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search__input {
  width: 100%;
  padding: 11px 12px 11px 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d0d10;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search__input:focus {
  border-color: var(--red);
}

.categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.cat-btn.is-active {
  background: var(--red-dim);
  color: var(--text);
}

.cat-btn.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}

.cat-btn__icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.sidebar__toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.sidebar__block--collapsible.is-open .sidebar__toggle svg {
  transform: rotate(180deg);
}

.sidebar__panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 4px;
}

.sidebar__block--collapsible.is-open .sidebar__panel {
  display: flex;
}

.radio,
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.radio input,
.check input {
  accent-color: var(--red);
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 16px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.brand__fallback {
  display: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #8b0000);
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
}

.brand__name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand__white {
  color: #fff;
}

.brand__red {
  color: var(--red);
}

.brand__badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid rgba(229, 9, 20, 0.5);
  border-radius: 6px;
}

.header__admin {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: color 0.2s, border-color 0.2s;
}

.header__admin:hover {
  color: var(--text);
  border-color: var(--red);
}

.catalog {
  flex: 1;
  padding: 8px 28px 40px;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.catalog__empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 1rem;
}

/* Mod card */
.mod-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.mod-card--clickable {
  cursor: pointer;
}

.mod-card:hover {
  transform: translateY(-3px);
  border-color: #333;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.mod-card__arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #1a1a1f;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--muted);
}

.mod-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0d0d10;
  overflow: hidden;
}

.mod-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mod-card__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 3rem;
  opacity: 0.25;
}

.mod-card__tags {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
}

.tag--legacy {
  background: rgba(229, 9, 20, 0.9);
  color: #fff;
}

.tag--enhanced {
  background: rgba(245, 197, 24, 0.95);
  color: #111;
}

.mod-card__fav {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #666;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: color 0.2s;
}

.mod-card__fav:hover,
.mod-card__fav.is-active {
  color: var(--red);
}

.mod-card__body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mod-card__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
}

.mod-card__desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mod-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mod-card__stats {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--muted);
}

.mod-card__stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mod-card__download {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #1a1a1f;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.mod-card__download:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Admin */
.admin-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.admin-card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.admin-card--wide {
  max-width: 720px;
}

.admin-card h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.admin-card p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d0d10;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compat-checks {
  display: flex;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn--primary {
  background: var(--red);
  color: #fff;
  width: 100%;
}

.btn--primary:hover {
  opacity: 0.9;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn--danger {
  background: rgba(229, 9, 20, 0.2);
  color: var(--red);
  border: 1px solid rgba(229, 9, 20, 0.4);
  padding: 6px 12px;
  font-size: 0.78rem;
}

.admin-error {
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.admin-success {
  color: #86efac;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.admin-list {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.admin-list h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.admin-mod-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  background: #141418;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #aaa;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.modal__close:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
}

.modal__preview {
  aspect-ratio: 16 / 9;
  background: #0a0a0d;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.modal__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__placeholder {
  font-size: 4rem;
  opacity: 0.2;
}

.modal__content {
  padding: 20px 22px 24px;
}

.modal__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding-right: 36px;
}

.modal__review {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #9b1133;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}

.modal__review:hover {
  color: #c41448;
  opacity: 0.95;
}

.modal__review.hidden {
  display: none;
}

.modal__review-icon {
  flex-shrink: 0;
}

.modal__text {
  font-size: 0.82rem;
  line-height: 1.55;
  color: #c8c8d0;
  margin-bottom: 20px;
  max-height: 220px;
  overflow-y: auto;
}

.modal__section-title {
  font-weight: 700;
  color: #fff;
  margin: 12px 0 6px;
}

.modal__section-title:first-child {
  margin-top: 0;
}

.modal__section p {
  margin-bottom: 4px;
}

.modal__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.modal__stat {
  background: #1c1c22;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}

.modal__stat-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.modal__stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.modal__download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e91e8c, #d4186f);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}

.modal__download:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .modal__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .header__admin {
    right: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
