/* The "generating" card (public/gen-progress.js). Laid over a page's result area while a job runs.

   Explicit colours throughout, never inherited: on the light theme the ground ink is near-white, and anything that
   inherits it on this onyx card would vanish. The !important on colours is deliberate for the same reason, so no page
   rule (many carry two ids) can repaint the card. It never changes the size of the area it sits in: the area's own
   content is hidden with visibility (it keeps its box) and the card is positioned over it. */

.gp-hosting > :not(.gp-host) { visibility: hidden !important; }

/* Positioning is !important: pages carry rules like `.video-console-grid .viewfinder-panel .viewfinder > *
   { position: relative }` that would otherwise drop the card into the flow as a tiny box. */
.gp-host {
  position: absolute !important;
  inset: 0 !important;
  z-index: 3 !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 12px;
  container-name: gp;
  container-type: size;
  pointer-events: auto;
  overflow: hidden;
  background: transparent !important;
}
/* An area with no height of its own (the Coverage clip slots are empty until the clip arrives): the card sits in it. */
.gp-host.gp-inflow {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  container-type: inline-size;
  padding: 0;
}

.gp-host .gp-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  border-radius: 16px;
  background: #0b0b0e !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #f4f6f7 !important;
  font-family: var(--font-ui, inherit);
  text-align: left;
  line-height: 1.25;
}
.gp-host.gp-inflow .gp-card { margin: 0 auto; }

.gp-host .gp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.gp-host .gp-left { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.gp-host .gp-right { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.gp-host .gp-label {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 12px; font-weight: 500; letter-spacing: 0.01em;
  color: #a9a9b1 !important;
}
.gp-host .gp-spin {
  flex: none; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid rgba(231, 234, 236, 0.22);
  border-top-color: var(--silver-bright, #f7f8f8);
  animation: gp-spin 0.9s linear infinite;
}
@keyframes gp-spin { to { transform: rotate(360deg); } }

.gp-host .gp-title {
  font-size: 26px; font-size: clamp(17px, 5.2cqi, 28px);
  font-weight: 600; letter-spacing: -0.015em;
  color: #f4f6f7 !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gp-host .gp-pct {
  font-size: 34px; font-size: clamp(22px, 7.4cqi, 38px);
  font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  color: #f4f6f7 !important;
  line-height: 1;
}
.gp-host .gp-eta { font-size: 12px; color: #a9a9b1 !important; white-space: nowrap; }

.gp-host .gp-bar {
  position: relative; height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08) !important;
}
.gp-host .gp-fill {
  position: absolute; inset: 0; display: block;
  transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--silver-dark-reflective, #bec4c9), var(--silver-bright, #f7f8f8)) !important;
  border-radius: inherit;
  transition: transform 1s linear;
}

.gp-host .gp-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-host .gp-pill {
  flex: 1 1 0; min-width: 0;
  padding: 6px 8px; border-radius: 999px; text-align: center;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #6f6f78 !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: color 0.4s ease, background-color 0.4s ease, border-color 0.4s ease;
}
.gp-host .gp-pill.on {
  color: #f4f6f7 !important;
  background: rgba(231, 234, 236, 0.12) !important;
  border-color: rgba(231, 234, 236, 0.28);
}
.gp-host .gp-pill.now { border-color: rgba(247, 248, 248, 0.55); }

.gp-host .gp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-host .gp-chip {
  padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: #a9a9b1 !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gp-host .gp-prompt {
  margin: 0;
  font-size: 13px; line-height: 1.45;
  color: #8f8f98 !important;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere;
}
.gp-host .gp-prompt[hidden] { display: none; }

/* Small areas (phones, side columns, short boxes): tighter spacing and smaller type. */
@container gp (max-width: 420px) {
  .gp-host .gp-card { padding: 12px 14px; gap: 8px; border-radius: 13px; }
  .gp-host .gp-left { gap: 5px; }
  .gp-host .gp-pills { gap: 4px; }
  .gp-host .gp-pill { flex: 1 1 calc(33% - 4px); font-size: 10.5px; padding: 4px 6px; }
  .gp-host .gp-chip { padding: 3px 8px; }
  .gp-host .gp-prompt { font-size: 12px; }
}
@container gp (max-height: 300px) {
  .gp-host .gp-card { padding: 12px 14px; gap: 8px; }
  .gp-host .gp-left { gap: 5px; }
  .gp-host .gp-pill { padding: 4px 6px; }
  .gp-host .gp-chip { padding: 3px 8px; }
}
@container gp (max-width: 300px) {
  .gp-host .gp-pill { flex-basis: calc(50% - 4px); }
  .gp-host .gp-label { white-space: nowrap; }
  .gp-host .gp-label-text { overflow: hidden; text-overflow: ellipsis; }
  .gp-host .gp-eta, .gp-host .gp-label, .gp-host .gp-chip { font-size: 10.5px; }
}
/* Short areas: drop the least needed lines first, so what stays always fits. */
@container gp (max-height: 190px) { .gp-host .gp-prompt { display: none; } }
@container gp (max-height: 145px) { .gp-host .gp-pills { display: none; } }
@container gp (max-height: 112px) { .gp-host .gp-chips { display: none; } }
@container gp (max-height: 80px) { .gp-host .gp-title { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .gp-host .gp-spin { animation: none; border-top-color: rgba(231, 234, 236, 0.22); background: var(--silver-bright, #f7f8f8); transform: scale(0.55); }
  .gp-host .gp-fill, .gp-host .gp-pill { transition: none; }
}
