html {
  height: 100%;
}
body {
  font-family: "Helvetica Neue", Helvetica, sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background-color: #eee;
  color: #3e3e3e;
}
body > span {
  flex: 1;
}
#body {
  overflow-y: auto;
  padding: 10px;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  /* fix scrolling issue in Windows */
  /* transform: translate3d(0, 0, 0); */
  overscroll-behavior: contain;
}

#toolbar {
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(6, min-content) 1fr min-content;
  grid-column-gap: 2px;
  grid-row-gap: 2px;
}

@media screen and (max-width: 600px) {
  #toolbar {
    grid-template-columns: repeat(5, 1fr);
  }
  #pattern {
    grid-column-start: 2;
    grid-column-end: 5;
  }
}

@media screen and (max-width: 400px) {
  #toolbar {
    grid-template-columns: repeat(2, 1fr);
  }
  #pattern {
    grid-column-end: 3;
    grid-column-start: 1;
  }
  input[data-cmd="rename"] {
    grid-column-end: 3;
    grid-column-start: 2;
  }
}
#toolbar input {
  box-sizing: border-box;
  color: #3e3e3e;
  border: none;
  background-color: #e4e4e4;
  padding: 10px;
  outline: none;
}
button:active,
input[type=button]:active {
  opacity: 0.5;
}

#progress {
  width: calc(100% - 20px);
  margin: 2px 10px;
}
.entry {
  flex: 1 0 152px;
  height: 152px;
  max-width: calc(100% - 10px);
  margin: 4px;
  position: relative;
  border: solid 1px #d7d8da;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  background-image: url('grid.png');
}
.entry input[type=checkbox] {
  position: absolute;
  top: 5px;
  right: 5px;
}
.entry input[type=text] {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  box-sizing: border-box;
  padding: 5px;
  outline: none;
  text-indent: 5px;
}
.entry a {
  position: absolute;
  top: 5px;
  left: 5px;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px;
  font-size: 80%;
  text-decoration: none;
}
.entry a:empty {
  display: none;
}
.entry img {
  max-height: 100%;
  min-width: 100%;
  object-fit: scale-down;
  overflow: hidden;
}
.entry img::after {
  content: "no preview";
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 40px;
  left: 0;
  width: 100%;
  height: calc(100% - 80px);
  background-image: url(grid.png);
}

[data-visible=false] {
  display: none;
}

input[type=button] {
  min-width: 48px;
  padding: 5px;
  border: none;
  background-color: #fff;
  color: #000;
  cursor: pointer;
  outline: none;
  font-size: 11px;
}
input[type=button]:active {
  background-color: #ccc;
}
input:disabled {
  opacity: 0.3;
}

body[data-top=true] [data-cmd=download],
body[data-top=true] [data-cmd=window] {
  opacity: 0.3;
  pointer-events: none;
}

::placeholder {
  color: #fff;
  opacity: 0.7;
}
