/* output */

.output {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
}

.output--empty {
  color: var(--ink-soft);
  font-size: 13px;
  font-style: italic;
}

.output-jump-link {
  color: var(--output-accent);
  font-weight: 600;
  text-decoration: underline;
}

.output img,
.output video,
.output audio {
  width: 100%;
  border-radius: 8px;
}

/* media frame - wraps a generated image/video with an always-visible Download control so
   "save the currently made image" is one click, not right-click-save-as guesswork */

.media-frame {
  position: relative;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
}

.media-frame-media {
  display: block;
  width: 100%;
}

/* guided-pipeline background picker (see steps.js's wireBackgroundPicker) - only wired up,
   and only gets this class, when generate-image comes back with more than one variant to
   choose between; a single-image result never gets the pointer cursor since there's nothing
   to pick between */
.media-frame--pickable {
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color .12s ease;
}

.media-frame--pickable.media-frame--selected {
  outline-color: var(--accent);
}

.download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(10, 14, 10, .55);
  color: #fff;
  transition: background-color .15s ease, transform .15s ease;
}

.download-btn svg {
  width: 15px;
  height: 15px;
}

.download-btn:hover {
  background: var(--output-accent);
  color: #fff;
  transform: scale(1.06);
}

.audio-frame {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-frame audio {
  flex: 1;
  min-width: 0;
  width: auto;
}

.audio-frame .download-btn {
  position: static;
  flex-shrink: 0;
  background: var(--output-accent-soft);
  color: var(--output-accent);
}

.audio-frame .download-btn:hover {
  background: var(--output-accent);
  color: #fff;
}

/* library (GET /tools/outputs) - one card per generation (see library.js's groupByToken),
   its inputs and what it produced together, stacked as a single readable column rather
   than a packed grid of same-sized tiles that can't tell a script apart from a thumbnail. */

.gen-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gen-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 10px;
  transition: background-color .6s ease;
}

.gen-row--focused {
  background: var(--input-accent-soft);
}

.gen-row-number {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-soft);
  padding-top: 16px;
}

.gen-row .gen-card {
  flex: 1;
  min-width: 0;
}

.gen-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--output-tint);
  border: 1px solid var(--output-tint-border);
  min-width: 0;
}

.gen-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gen-card-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--output-accent);
  min-width: 0;
}

.gen-card-step svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.gen-card-when {
  font-size: 12px;
  flex-shrink: 0;
}

.gen-section-label {
  display: block;
  font-size: 11px;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.gen-used {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper);
}

.gen-used-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gen-used-field {
  display: flex;
  gap: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.gen-used-field > span:first-child {
  flex-shrink: 0;
}

.gen-used-field--json {
  flex-direction: column;
  gap: 4px;
}

.gen-used-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gen-used-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.gen-used-thumbs:first-child {
  margin-top: 0;
}

.gen-used-thumbs .gen-thumb {
  width: 56px;
  height: 56px;
}

.gen-thumb {
  aspect-ratio: 1 / 1;
  background: var(--paper);
}

.gen-thumb .media-frame-media {
  height: 100%;
  object-fit: cover;
}

.gen-result-media {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gen-result-media .media-frame {
  width: 220px;
  max-width: 100%;
}

.gen-result-media .audio-frame {
  width: 100%;
}

.gen-result-text-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gen-result-text {
  font-size: 13px;
  line-height: 1.4;
  max-height: 200px;
  overflow: hidden;
}

.gen-result-text.is-expanded {
  max-height: none;
}

.gen-result-text-inner {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gen-expand-btn {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--output-accent);
  padding: 0;
}

.gen-script-open {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}

.gen-card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.gen-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.gen-link svg {
  width: 12px;
  height: 12px;
}

.output-table {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}

.output-table-head,
.output-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 64px);
  align-items: center;
  gap: 12px;
}

.output-table-head span:not(:first-child),
.output-table-row span:not(:first-child) {
  text-align: right;
}

.output-table-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.output-table-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
}

.output-table-row .num {
  font-size: 12px;
  color: var(--ink-soft);
}

.output-table-row:last-child {
  border-bottom: none;
}

.output-table-row:hover .output-table-title {
  color: var(--accent);
}

.output-table-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output pre {
  white-space: pre-wrap;
  margin: 0;
  font-size: 12px;
}

/* empty state */

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 56px 32px;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state h2 {
  color: var(--ink);
  font-size: 20px;
}

.empty-state p {
  margin: 10px auto 0;
  max-width: 42ch;
  font-size: 14px;
}

/* shot gallery */

#shots-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.shot-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.shot-media {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: var(--paper);
  display: block;
}

.shot-media .media-frame-media {
  height: 100%;
  object-fit: cover;
}

.shot-media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-soft);
}

.shot-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shot-num {
  font-size: 12px;
  color: var(--ink-soft);
}

/* generate-characters' output (see output-render.js's charactersHtml) - same grid-of-
   thumbnails language as .shot-grid above, just square and labeled by character name */
.sprite-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}

.sprite-sheet-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sprite-sheet-label {
  font-size: 12px;
  text-transform: capitalize;
}

.sprite-sheet-frame {
  aspect-ratio: 1;
  background: var(--paper);
}

.sprite-sheet-frame .media-frame-media {
  height: 100%;
  object-fit: cover;
}

.shot-card-body p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

