:root {
  --bg: #07070f;
  --panel: #12122a;
  --panel-2: #1b1b38;
  --navy: #191970;
  --lav: #e6e6fa;
  --red: #d81a20;
  --text: #e6e6fa;
  --muted: #9a9ac0;
  --border: #2a2a4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
}

main.wrap {
  min-height: calc(100vh - 120px);
}

a {
  color: #8ab4ff;
}

.topbar {
  background: linear-gradient(180deg, var(--navy), #0d0d33);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--red);
  border-radius: 4px;
  font-weight: 900;
}

.brand-text em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
}

.search {
  margin-left: auto;
  flex: 1 1 260px;
  max-width: 420px;
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0b0b1e;
  color: var(--text);
  font-size: 14px;
}

.search input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.sections {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  min-height: 40px;
  padding: 0 0 8px;
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
}

.sections button {
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  color: var(--lav);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.sections button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sections button.active {
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 18px 0 10px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding-bottom: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.08s ease, border-color 0.08s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--red);
}

.card .thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--panel-2), #0d0d1f);
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card .title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.tag.section {
  background: rgba(216, 26, 32, 0.15);
  color: #ff8f94;
  border-color: rgba(216, 26, 32, 0.4);
}

.badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 700;
}

.badge.mega {
  background: #b81b1b;
  color: #fff;
}

.badge.torrent {
  background: #1f7a44;
  color: #fff;
}

.empty,
.statusbar .error {
  color: #ff8f94;
}

.footer {
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 18px 0 40px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

[hidden] {
  display: none !important;
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 22px;
}

.modal-body h2 {
  margin: 0 0 4px;
  font-size: 20px;
  color: #fff;
}

.modal-body .shot {
  width: 100%;
  border-radius: 6px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0;
}

.kv span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.kv b {
  color: var(--text);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 4px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.btn.mega {
  background: #b81b1b;
}

.btn.torrent {
  background: #1f7a44;
}

.btn.page {
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.btn.disabled {
  background: #33334d;
  color: #8888a0;
  cursor: not-allowed;
}
