* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
  background: #0b0e11;
  color: #e5e7eb;
}

header {
  padding: 12px 16px;
  border-bottom: 1px solid #1f2937;
}

h1 {
  margin: 0 0 8px;
  font-size: 18px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

input {
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #1f2937;
  padding: 6px 8px;
  border-radius: 4px;
  min-width: 260px;
}

button {
  background: #2563eb;
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

main {
  padding: 12px;
}

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

.video-card {
  background: #020617;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #1f2937;
}

.video-card:hover {
  border-color: #2563eb;
}

.video-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  background: #000;
}

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

.video-wrap video {
  position: absolute;
  inset: 0;
  display: none;
}

.video-meta {
  padding: 6px 8px;
  font-size: 12px;
  background: #020617;
}

.video-meta .time {
  color: #9ca3af;
}

.video-card.playing video {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  position: relative;
  width: 90vw;
  max-width: 1400px;
  aspect-ratio: 16 / 9;
  background: black;
}

.modal-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: black;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;

  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;

  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.close-btn::before,
.close-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  background: #fff;
  transform-origin: center;
}

.close-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
