/* 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;
}

/* Stage toolbar: Blocks (the measuring pad) or Scene (a real hole, drawn by
   the game, with the golfer). */
body[data-app="sprites"] #stage { display: flex; flex-direction: column; background: #e8eee4; }
#sprite-stage, #sprite-scene { flex: 1; min-height: 0; width: 100%; border: 0; display: block; }
#sprite-stage[hidden], #sprite-scene[hidden] { display: none; }
.stage-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 12px; background: var(--bar); border-bottom: 1px solid var(--line);
}
.stage-bar .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stage-bar .seg button { border: 0; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; padding: 6px 10px; cursor: pointer; }
.stage-bar .seg button + button { border-left: 1px solid var(--line); }
.stage-bar .seg button.is-on { background: var(--accent); color: #fff; }
.stage-bar .scene-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--dim); }
.stage-bar select { font: inherit; font-size: 12px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); max-width: 260px; }
.stage-bar .stage-hint { font-size: 11px; color: var(--dim); }
#stage.no-scene .scene-only { display: none; }
.stage-bar a.primary.sm { text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.scene-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 30px; text-align: center; color: var(--dim); }
.scene-empty[hidden] { display: none; }
.scene-empty p { max-width: 380px; margin: 0; line-height: 1.5; }

/* Which biomes a sprite is offered in. */
.biome-pick { margin: 12px 0; }
.biome-pick > span { display: block; font-size: 12px; font-weight: 700; color: var(--dim); margin-bottom: 6px; }
.biome-pick em { font-style: normal; font-weight: 500; }
.biome-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.biome-checks label {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 12px; cursor: pointer; background: var(--panel-2);
}
.biome-checks label.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.biome-checks input { display: none; }
.lib-biomes { display: block; font-size: 10px; color: var(--dim); }
.lib-biomes.is-unsorted { color: #b3541e; font-weight: 700; }
.biome-checks label.is-unsorted.is-on { background: #b3541e; border-color: #b3541e; }
.inbox-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.inbox-only { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
