:root {
  color-scheme: dark;
  --bg: #0b0a0d;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-hot: rgba(255, 255, 255, 0.16);
  --text: #f7f4f4;
  --muted: rgba(247, 244, 244, 0.58);
  --line: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(125, 35, 65, 0.24), transparent 34rem),
    linear-gradient(135deg, #0b0a0d 0%, #170c12 48%, #071517 100%);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
button:focus-visible,
.card:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.82);
  outline-offset: 3px;
}

.app {
  width: min(1764px, calc(100vw - 72px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

p {
  margin: 0;
}

#status {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
}

.tools {
  display: flex;
  gap: 10px;
}

.tools button {
  width: 54px;
  height: 46px;
  font-size: 22px;
}

.categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 3px 18px;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 16px;
  white-space: nowrap;
}

.chip.active {
  background: #fff;
  color: #08080a;
}

.browser-bar,
.filters,
.related {
  display: flex;
  align-items: center;
  gap: 10px;
}

.browser-bar {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

input,
select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  padding: 0 13px;
  font: inherit;
  font-weight: 700;
}

input {
  width: min(360px, 100%);
}

select {
  min-width: 94px;
}

.filter,
.related-link {
  height: 40px;
  padding: 0 13px;
}

.filter.active {
  background: rgba(255, 255, 255, 0.9);
  color: #08080a;
}

.related {
  min-height: 38px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.related span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.related-link {
  flex: 0 0 auto;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.load-more {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.card {
  display: block;
  min-width: 0;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

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

.badge {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
}

.title {
  min-height: 44px;
  margin: 9px 0 7px;
  font-size: 18px;
  line-height: 1.18;
  font-weight: 750;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: var(--text);
}

.viewer::backdrop {
  background: #000;
}

.stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.stage video,
.stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.close,
.nav {
  position: fixed;
  z-index: 3;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}

.close {
  right: 26px;
  top: 24px;
  width: 52px;
  height: 52px;
  font-size: 30px;
}

.nav {
  top: 50%;
  width: 58px;
  height: 76px;
  transform: translateY(-50%);
  font-size: 46px;
}

.prev {
  left: 22px;
}

.next {
  right: 22px;
}

.caption {
  position: fixed;
  left: 32px;
  bottom: 28px;
  width: min(720px, calc(100vw - 64px));
  padding: 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
}

.caption h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.18;
}

.caption p {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app {
    width: calc(100vw - 24px);
    padding-top: 18px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .title {
    font-size: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .filters {
    width: 100%;
    overflow-x: auto;
  }
}
