.creator-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.generation-screen {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  background:
    radial-gradient(110% 110% at 60% 0%, rgba(255, 240, 176, 0.1), transparent 47%),
    radial-gradient(110% 110% at 15% 85%, rgba(53, 216, 200, 0.12), transparent 46%),
    #05070a;
}

.generation-screen[hidden] {
  display: none;
}

.generation-card {
  width: min(640px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 18px;
  background: rgba(23, 27, 34, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  display: grid;
  gap: 14px;
}

.generation-label {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.83rem;
}

.generation-card h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.05;
}

.generation-name-line {
  margin: -2px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.generation-loader {
  position: relative;
  width: 74px;
  height: 74px;
  margin: 6px auto 4px;
  border-radius: 999px;
}

.generation-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 999px;
  border: 3px solid transparent;
  border-top-color: var(--gold);
  border-right-color: var(--cyan);
  animation: spin 1.1s linear infinite;
  opacity: 0.95;
}

.generation-ring:nth-child(2) {
  inset: 8px;
  border-width: 3px;
  border-top-color: var(--cyan);
  border-right-color: rgba(255, 255, 255, 0.25);
  animation-duration: 1.4s;
  animation-direction: reverse;
}

.generation-ring:nth-child(3) {
  inset: 16px;
  border-top-color: rgba(255, 255, 255, 0.65);
  border-right-color: var(--gold);
  animation-duration: 1.9s;
  animation-direction: reverse;
}

.generation-phrase {
  margin: 2px auto;
  min-height: 1.5em;
  color: var(--ink);
  font-weight: 850;
  max-width: 44ch;
}

.generation-step-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.generation-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.5em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.generation-step.active {
  border-color: rgba(255, 240, 176, 0.6);
  background: rgba(242, 200, 75, 0.14);
  color: var(--gold);
}

.generation-step.done {
  border-color: rgba(53, 216, 200, 0.55);
  background: rgba(53, 216, 200, 0.12);
  color: #6fffe2;
}

.generation-eta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.creator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 16px;
}

.ai-lab-panel,
.creator-form,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.9);
  box-shadow: var(--shadow);
}

.ai-lab-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 22px;
}

.ai-lab-panel .section-heading h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4.5vw, 4.4rem);
  line-height: 0.95;
}

.ai-lab-form {
  display: grid;
  gap: 14px;
}

.ai-description-field,
.ai-settings label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.ai-description-field textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #0d1015;
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.4;
}

.forge-cost {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.1em;
}

.ai-generation-summary {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.ai-generation-summary p {
  margin: 0;
}

.ai-clarification-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(53, 216, 200, 0.05);
}

.ai-clarification-questions {
  display: grid;
  gap: 10px;
}

.ai-clarification-question {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.94rem;
}

.ai-clarification-question .hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.ai-clarification-question input,
.ai-clarification-question select,
.ai-clarification-question textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0d1015;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
}

.ai-clarification-question textarea {
  resize: vertical;
  min-height: 74px;
}

.ai-clarification-question small {
  color: var(--muted);
  font-size: 0.76rem;
}

.ai-clarification-actions {
  margin-top: 2px;
}

.ai-settings {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(140px, 0.6fr));
  gap: 12px;
}

select,
.ai-description-field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #0d1015;
  color: var(--ink);
  font: inherit;
  font-size: 1.04rem;
}

.ai-description-field textarea {
  min-height: 90px;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.35;
}

.creator-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.form-section {
  display: grid;
  gap: 12px;
}

.form-section label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.form-section span,
.save-status {
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="url"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #0d1015;
  color: var(--ink);
  font: inherit;
  font-size: 1.04rem;
}

input[type="color"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #0d1015;
}

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

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-weight: 900;
}

.segmented input:checked + span {
  border-color: transparent;
  background: var(--gold);
  color: #111317;
}

.color-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.color-grid .eyebrow {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.save-status {
  min-height: 1.3em;
  margin: -4px 0 0;
  color: var(--cyan);
}

.save-status.status-working {
  color: var(--gold);
}

.save-status.status-error {
  color: #ff8a8a;
}

.upload-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.84rem;
  color: var(--muted);
}

.upload-status.upload-ok {
  color: var(--cyan);
}

.upload-status.upload-error {
  color: #ff8a8a;
}

.preview-panel {
  display: grid;
  align-content: center;
  gap: 22px;
  min-height: 560px;
  padding: 26px;
}

.avatar-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: min(280px, 68vw);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 5px solid var(--avatar-accent, #35d8c8);
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--avatar-primary, #f05a46), #141821 68%),
    #141821;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

.avatar-preview img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
}

.avatar-preview span {
  color: #fff;
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 950;
  text-transform: uppercase;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.avatar-preview.has-image span {
  display: none;
}

.preview-copy {
  text-align: center;
}

.preview-copy h1 {
  margin: 8px 0 8px;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 1;
}

.preview-copy p:last-child {
  margin: 0;
  color: var(--muted);
}

.preview-bars {
  display: grid;
  gap: 8px;
}

.preview-bars span {
  display: block;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.preview-bars span::before {
  content: "";
  display: block;
  width: var(--bar);
  height: 100%;
  background: linear-gradient(90deg, var(--avatar-primary, #f05a46), var(--avatar-accent, #35d8c8));
}

.generated-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 34, 0.9);
  box-shadow: var(--shadow);
}

.generated-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.generated-empty {
  margin: 0;
  color: var(--muted);
}

.generated-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 128px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.generated-card.selected {
  border-color: rgba(53, 216, 200, 0.66);
  background: rgba(53, 216, 200, 0.08);
  box-shadow: inset 0 0 0 1px rgba(53, 216, 200, 0.16);
}

.generated-card img {
  width: 76px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.generated-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.generated-copy strong,
.generated-copy small {
  overflow-wrap: anywhere;
}

.generated-copy small {
  color: var(--muted);
}

.balance-line {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.balance-line.approved {
  color: var(--cyan);
  background: rgba(53, 216, 200, 0.08);
}

.balance-line.needs-review {
  color: var(--gold);
  background: rgba(242, 200, 75, 0.09);
}

.generated-provider {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.generated-provider.provider-ollama {
  border-color: rgba(80, 255, 196, 0.45);
  color: #6bffe4;
  background: rgba(80, 255, 196, 0.14);
}

.generated-provider.provider-openai {
  border-color: rgba(127, 219, 255, 0.45);
  color: #7fdbff;
  background: rgba(127, 219, 255, 0.12);
}

.generated-provider.provider-fal {
  border-color: rgba(255, 200, 74, 0.45);
  color: #ffd56b;
  background: rgba(255, 199, 71, 0.12);
}

.generated-provider.provider-unknown {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.selected-line {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(53, 216, 200, 0.36);
  border-radius: 999px;
  color: #101318;
  background: var(--cyan);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.selected-line[hidden] {
  display: none;
}

.generated-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.generated-chip {
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.generated-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.generated-actions .tool-button {
  flex: 0 1 auto;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.generated-actions .generated-play {
  flex: 1 1 128px;
}

.generated-actions .tool-button:disabled,
.generated-actions .tool-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 840px) {
  .creator-layout {
    grid-template-columns: 1fr;
  }

  .ai-settings {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .segmented,
  .color-grid {
    grid-template-columns: 1fr;
  }
}
