/* Result, download, copy, and task detail surfaces. */
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin-top: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--creator-red);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.download-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.download-icon-button.with-text {
  width: auto;
  gap: 7px;
  padding: 0 12px;
  font-size: 15px;
}
.download-icon-button.with-text span {
  font-size: 13px;
  font-weight: 700;
}
.result-download {
  margin-top: 0;
}
.result-state-user-friendly {
  border: 1px solid #fed7aa;
  background: #fff7ed;
}
.result-state-user-friendly p {
  max-width: 720px;
  color: #7c2d12;
}
.portal-result-body {
  padding: 12px;
}
.portal-result-actions {
  padding: 8px 10px;
}
.running-copy-preview {
  margin-top: 10px;
}
.result-ready-head {
  margin-bottom: 8px;
}
.result-ready-head strong {
  font-size: 15px;
}
.task-input-box {
  display: grid;
  gap: 7px;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  background: #fafafa;
}
.task-input-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #111;
  font-size: 12px;
  font-weight: 800;
}
.task-input-box-head small {
  flex: 0 0 auto;
  color: #8a8f98;
  font-size: 11px;
  font-weight: 600;
}
.task-input-box p {
  max-height: 132px;
  margin: 0;
  overflow: auto;
  color: #444;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-task-input-box {
  margin: 12px 0 14px;
}
.admin-task-input-box p {
  max-height: 168px;
}
.partial-result-grid {
  margin-top: 10px;
}
.running-result-preview {
  margin-top: 10px;
}
.running-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.running-result-head span {
  color: #6b7280;
}
.retry-task-button {
  width: auto;
  min-width: 128px;
  padding: 0 18px;
}
.result-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.result-image-wrap {
  position: relative;
  display: block;
  min-width: 0;
}
.result-image {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: zoom-in;
}
.result-image img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border: 1px solid #f0d9de;
  border-radius: 6px;
  background: #fff;
}
.result-image span {
  color: #555;
  font-size: 11px;
  line-height: 1.25;
  padding-right: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-image-placeholder {
  min-height: 0;
  aspect-ratio: 3 / 4;
  place-content: center;
  padding: 10px;
  border: 1px dashed #fca5a5;
  border-radius: 6px;
  background: #fff7f7;
  color: #9f1239;
  text-align: center;
  cursor: default;
}
.result-image-placeholder span:last-child {
  padding-right: 0;
  color: #9f1239;
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}
.result-image-loading-dot {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto 6px;
  border: 3px solid #fecaca;
  border-top-color: var(--creator-red, #ff2442);
  border-radius: 50%;
  animation: result-spin 0.9s linear infinite;
}
.image-regenerating-badge {
  position: absolute;
  right: 4px;
  bottom: 0;
  display: inline-flex;
  min-height: 21px;
  align-items: center;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--creator-red, #ff2442);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
@keyframes result-spin {
  to {
    transform: rotate(360deg);
  }
}
.result-copy {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #f0d9de;
  border-radius: 8px;
  background: #fff;
}
.result-copy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.copy-field {
  display: grid;
  gap: 6px;
}
.copy-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.copy-field-head span {
  color: #555;
  font-size: 12px;
  font-weight: 700;
}
.copy-box {
  max-height: 96px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #f2e1e4;
  border-radius: 7px;
  background: #fff8f9;
  color: #555;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
}
.copy-field-body .copy-box {
  max-height: 144px;
}
.mini-action {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.mini-action.danger {
  border-color: #fed7aa;
  color: var(--danger);
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
}
.lightbox.is-open {
  display: grid;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.58);
}
.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}
.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.lightbox-head button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
.lightbox-panel.image-panel {
  width: min(620px, calc(100vw - 32px));
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.lightbox-panel.image-panel img {
  max-width: 100%;
  max-height: min(70vh, 720px);
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  background: #f6f6f7;
}
.lightbox-panel.image-panel .download-link {
  justify-self: center;
  margin: 0 0 14px;
}
.lightbox-counter {
  margin-left: 12px;
  color: #999;
  font-size: 12px;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.2s;
}
.lightbox-nav:hover {
  background: #fff;
}
.lightbox-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.lightbox-nav-prev { left: 20px; }
.lightbox-nav-next { right: 20px; }
.lightbox-nav.is-hidden { display: none; }
.admin-task-detail {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}
.admin-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}
.admin-task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafafa;
  color: #555;
  font-size: 12px;
}
.admin-task-meta b {
  color: var(--ink);
}
.admin-task-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff7f7;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.5;
}
@media (max-width: 720px) {
  .result-image-grid,
  .admin-task-detail .result-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lightbox {
    padding: 12px;
  }
  .lightbox-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}