/* Sprite editor. Sits on the course-editor chrome. */

body[data-app="sprites"] #panel { bottom: 0; width: 320px; }
body[data-app="sprites"] #stage {
  position: absolute;
  top: var(--bar-h);
  left: 0;
  right: 320px;
  bottom: 0;
  background: #3f5340;
}

#sprite-stage { width: 100%; height: 100%; display: block; }

#sprite-result {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}
#sprite-result a { color: var(--accent); }

.scale-readout {
  display: flex;
  justify-content: space-between;
  margin: 12px 0 4px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
}

input[type="range"] { width: 100%; accent-color: var(--accent); }

#sprite-file { margin-bottom: 10px; }

/* Edit mode swaps the upload fields out. Beat any display rule on them. */
#panel [hidden] { display: none !important; }

#sprite-editing { color: var(--ink); font-weight: 700; margin: 0 0 8px; }
#sprite-new, #sprite-delete { width: 100%; margin-top: 8px; }

/* Library: a 4-column grid of small thumbnails that scrolls. */
body[data-app="sprites"] #sprite-lib {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
}
body[data-app="sprites"] #sprite-lib .hint { grid-column: 1 / -1; }
body[data-app="sprites"] #sprite-lib button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bar-2);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
body[data-app="sprites"] #sprite-lib button.is-active { border-color: var(--accent); }
body[data-app="sprites"] #sprite-lib img {
  display: block;
  width: 100%;
  max-width: 56px;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: #c9d4c4;
  border-radius: 4px;
}
body[data-app="sprites"] #sprite-lib .lib-name {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
