.workspace + .modal.profile-wizard {
  --wizard-surface: #fffdfb;
  --wizard-inset: #f8f5f2;
  --wizard-raise: #f1eafb;
  --wizard-line: #e7e0e7;
  --wizard-control: #93849d;
  --wizard-text: #211b2d;
  --wizard-muted: #625969;
  --wizard-lilac: #6845b8;
  --wizard-gold: #83562c;
  --wizard-photo: #251e34;
  --wizard-danger: #893c52;
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - max(26px, env(safe-area-inset-top)) - env(safe-area-inset-bottom));
  border: 1px solid var(--wizard-line);
  border-radius: 17px;
  background: var(--wizard-surface);
  color: var(--wizard-text);
  color-scheme: light;
  scrollbar-color: var(--wizard-control) transparent;
}

.workspace + .modal.profile-wizard::backdrop { background: #21152d8f; }

.meluming-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 4px;
  border-radius: 8px;
  background: #f1eafb;
  color: #4e3078;
  font-size: 13px;
  font-weight: 690;
}
.meluming-badge img { width: 23px; height: 31px; object-fit: contain; }
.wizard-meluming { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-top: 10px; }
.wizard-meluming p { color: var(--wizard-muted); font-size: 13px; }

.profile-wizard .modal-header {
  align-items: center;
  padding: 21px 26px 11px;
}

.workspace + .modal.profile-wizard .modal-header h2 {
  font-family: var(--serif);
  font-size: clamp(23px, 5.25vw, 30px);
  letter-spacing: -.026em;
  line-height: 1.3;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.workspace + .modal.profile-wizard .modal-header .icon-button {
  min-width: 40px;
  min-height: 40px;
  border-color: var(--wizard-line);
  background: var(--wizard-inset);
  color: var(--wizard-muted);
}

.workspace + .modal.profile-wizard .modal-header .icon-button:hover:not(:disabled) {
  background: var(--wizard-raise);
  color: var(--wizard-text);
}

.profile-wizard .modal-content { padding: 0 26px 22px; }

.profile-wizard .button.primary {
  border-color: var(--wizard-lilac);
  background: var(--wizard-lilac);
  color: var(--wizard-surface);
}

.profile-wizard .button.primary:hover:not(:disabled) {
  border-color: #533593;
  background: #533593;
}

.profile-wizard .button.outline {
  border-color: var(--wizard-control);
  background: var(--wizard-surface);
  color: var(--wizard-lilac);
}

.profile-wizard .button.ghost { color: var(--wizard-lilac); }
.profile-wizard .button:is(.outline, .ghost):hover:not(:disabled) { background: var(--wizard-raise); }

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 3px 0 23px;
  padding: 0;
  list-style: none;
}

.wizard-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--wizard-line);
  border-radius: 8px;
  background: var(--wizard-inset);
  color: var(--wizard-muted);
  font-size: 13px;
  font-weight: 650;
}

.wizard-steps li[aria-current="step"] {
  border-color: #c9b7e4;
  background: var(--wizard-raise);
  color: var(--wizard-lilac);
}

.wizard-steps li > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--wizard-raise);
  color: var(--wizard-lilac);
  font-variant-numeric: tabular-nums;
}

.wizard-steps li[aria-current="step"] > span {
  background: var(--wizard-lilac);
  color: var(--wizard-surface);
}

.wizard-steps .icon { width: 14px; height: 14px; }

.wizard-stage h3 {
  font-size: clamp(19px, 3.7vw, 23px);
  font-weight: 750;
  letter-spacing: -.026em;
  line-height: 1.35;
  word-break: keep-all;
}

.wizard-stage > p {
  margin: 5px 0 16px;
  color: var(--wizard-muted);
  font-size: 14px;
  line-height: 1.72;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.wizard-upload {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.profile-wizard .wizard-upload .upload-label { min-height: 44px; }

.wizard-upload-disabled { opacity: .55; cursor: default; }
.wizard-upload-disabled input { pointer-events: none; }

.wizard-count {
  color: var(--wizard-muted);
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: lining-nums tabular-nums;
}

.wizard-photo-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wizard-photo-slot { min-width: 0; }

.wizard-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--wizard-line);
  border-radius: 10px;
  background: var(--wizard-photo);
}

.wizard-photo-slot:first-child .wizard-thumb { border-color: var(--wizard-gold); }
.wizard-thumb img { width: 100%; height: 100%; object-fit: cover; }

.profile-wizard .wizard-photo-delete {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 34px;
  height: 34px;
  min-width: 0;
  min-height: 0;
  place-items: center;
  border: 1px solid #bfa5bb;
  border-radius: 50%;
  background: #17121eea;
  color: #fff4f1;
}

.profile-wizard .wizard-photo-delete:hover:not(:disabled) { background: #41284c; }
.wizard-photo-delete .icon { width: 17px; height: 17px; }

.wizard-primary-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  color: var(--wizard-gold);
  font-size: 12px;
  font-weight: 720;
}

.profile-wizard .wizard-photo-pick {
  width: 100%;
  min-height: 35px;
  padding: 5px 2px;
  color: var(--wizard-lilac);
  font-size: 12px;
}

.workspace + .modal.profile-wizard .crop-editor {
  margin: 10px 0 0;
  padding: 12px;
  border-color: var(--wizard-line);
  background: var(--wizard-inset);
}

.workspace + .modal.profile-wizard .crop-preview {
  width: min(120px, 100%);
  background: var(--wizard-photo);
  color: var(--wizard-raise);
}

.workspace + .modal.profile-wizard .crop-controls :is(small, .crop-range) { color: var(--wizard-muted); }
.profile-wizard .crop-controls strong { font-size: 14px; }
.profile-wizard .crop-range input { accent-color: var(--wizard-lilac); }
.profile-wizard :focus-visible { outline-color: var(--wizard-lilac); }

.profile-wizard .wizard-fields { gap: 14px 12px; }
.wizard-fields .field { min-width: 0; color: var(--wizard-text); }
.wizard-fields .wizard-name { grid-column: 1 / -1; }

.workspace + .modal.profile-wizard .wizard-fields .field :is(input, textarea, select) {
  min-width: 0;
  min-height: 45px;
  border-color: var(--wizard-control);
  background: var(--wizard-surface);
  color: var(--wizard-text);
}

.workspace + .modal.profile-wizard .wizard-fields :is(input, textarea)::placeholder { color: var(--wizard-muted); }

.wizard-status {
  margin-top: 8px;
  color: var(--wizard-lilac);
  font-size: 13px;
  line-height: 1.5;
}

.wizard-status:empty { display: none; }

.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 19px;
  padding-top: 13px;
  border-top: 1px solid var(--wizard-line);
}

.profile-wizard .wizard-footer .button { min-height: 44px; }
.profile-wizard .wizard-footer .wizard-remove { color: var(--wizard-danger); }

@media (max-width: 450px) {
  .profile-wizard .modal-header { padding: 16px 16px 9px; }
  .profile-wizard .modal-content { padding: 0 16px 16px; }
  .wizard-steps { margin-bottom: 18px; }
  .wizard-photo-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-wizard .wizard-photo-delete { width: 38px; height: 38px; }
  .profile-wizard .wizard-photo-pick { min-height: 41px; }
  .workspace + .modal.profile-wizard .crop-preview { width: min(91px, 38%); }
  .workspace + .modal.profile-wizard .wizard-fields .field :is(input, textarea, select) { font-size: 16px; }
}
