:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d232f;
  --muted: #677182;
  --line: #dfe4ea;
  --accent: #0d7c66;
  --accent-strong: #095f4e;
  --warm: #d97b35;
  --shadow: 0 18px 48px rgba(29, 35, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px clamp(18px, 4vw, 56px) 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  min-width: 138px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.stats strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

main {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 48px;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.search {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.search input {
  height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 124, 102, 0.14);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tab {
  height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

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

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(29, 35, 47, 0.06);
}

.preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 0;
  padding: 0;
  background: #e8edf1;
  cursor: zoom-in;
  overflow: hidden;
}

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

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 46px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.42);
}

.meta {
  display: grid;
  gap: 8px;
  padding: 13px 14px 15px;
}

.meta h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.meta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  margin: 46px 0 0;
  color: var(--muted);
  text-align: center;
}

.viewer {
  width: min(1100px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.viewer::backdrop {
  background: rgba(15, 20, 28, 0.7);
}

.viewer-panel {
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.viewer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.viewer-head p {
  margin: 0 0 4px;
  color: var(--warm);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.viewer-head h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.close-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.viewer-body {
  display: grid;
  place-items: center;
  background: #111822;
  max-height: calc(100vh - 134px);
}

.viewer-body img,
.viewer-body video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 134px);
}

@media (max-width: 760px) {
  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    justify-content: stretch;
  }

  .stats span {
    flex: 1 1 150px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
  }
}
